From patchwork Tue Dec 5 20:43:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 120749 Delivered-To: patch@linaro.org Received: by 10.80.152.193 with SMTP id j59csp2636740edb; Tue, 5 Dec 2017 12:44:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMYzJ/Dq9j3f/b4OFuq4+9LBrdpBo1qW9UkwNYipnvoq+UO+256IQbe/1wK6AA8iM0UUKtad X-Received: by 10.101.65.74 with SMTP id x10mr18559975pgp.388.1512506669705; Tue, 05 Dec 2017 12:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512506669; cv=none; d=google.com; s=arc-20160816; b=btr+Vn9WztoaER8HfJ5nu1nbl63ISsxqkf6TA2Qhl8ltrjCuLG/xVW+IE9pqUiYcAS R81htpIEMNuT+A1xUGdaksU7IyOPrs4RafFsYzlUrenBn1ngbvQkkIlkSozlbU7V8CvV 7t6RPVE+cw2OqzEF+CJbWgORjA33+3K7NZOfiGOGxidVnlY7cnZRISmKpShPPc4cw/lM 45kVN9zKFb9NKG+/+Ulbf9kQdF3t3BLvlDcJexS2WNYE/EOFCeSVHMfmicW++qC3lRn7 sklHhqNvusFq4RwJhhn7hDlhKzrU6A1XYEKe86IEvfT8NKj3F12dEW6XMkimNAeZh7Eg vtFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=r2MJDYRHhxBuAe3XC6L3qBqMD8zsPmylXYRJtIH39tM=; b=t807FhT1xdkUUYVIfOh1mJ8rV6dniVRzUUkA+nFcVkvdNhcDFV2iX8vhtJOEka7Y19 JK1KRUYZ/AwQ0QWEW3rkKM86bxRlEBydsgEdfKk3XORUtQNDJP30K6zXYJAqpW1Els9g Msd9q102MOVMAJqHZnTco84FlZ7caFeF9kCPD52orwNoTiDAxkCyHZa9PFAZePpWjyQg E9T2r+SdIlzNzRgGsULLyjs5LUGDiwDXiO0SaIYCIVmocx6j8BI+u1Bm4x684/5z39uE rQ76IzpVxQdMRvbtx/w3oLiyy9fYd4a8g3AQ0jc6zSWqDBRfjcFnH8t9rOewzrettoc2 hh+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FYs6ofY8; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si640919plk.435.2017.12.05.12.44.29 for ; Tue, 05 Dec 2017 12:44:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FYs6ofY8; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbdLEUo1 (ORCPT ); Tue, 5 Dec 2017 15:44:27 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:29139 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751709AbdLEUnt (ORCPT ); Tue, 5 Dec 2017 15:43:49 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id vB5KhY1L031076; Tue, 5 Dec 2017 14:43:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1512506614; bh=j4H2MQzKlicB34yZwpWnu1eFWJLXp8q9Dg/tJUcmwAo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FYs6ofY8dsK76/K/Fa6uiz7lK1qMcHnSfI25h2b7CrXex9+SIEwTqQHhuLZ1xJJ9W 78xs5mcfEWTlH4IMigStoipL/uGjen99MfGl3KYMAjUmlViZrtlt8LUaCcb0tjG7h8 d0lCh0LF4PyX0UF6k/zq7g6UpPBYBFUTXaxXfQOY= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KhYC5017024; Tue, 5 Dec 2017 14:43:34 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 5 Dec 2017 14:43:34 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 5 Dec 2017 14:43:34 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KhYBO010541; Tue, 5 Dec 2017 14:43:34 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.93.77]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vB5KhX325085; Tue, 5 Dec 2017 14:43:33 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v2 6/6] leds: lp8860: Various fixes to align with LED framework Date: Tue, 5 Dec 2017 14:43:27 -0600 Message-ID: <20171205204327.12111-7-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171205204327.12111-1-dmurphy@ti.com> References: <20171205204327.12111-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Update the driver to conform with the LED framework. Use devm_led_classdev_register Destroy mutex on exit Remove dependency on CONFIG_OF in the driver and move to the Kconfig Update the MODULE_LICENSE to GPL v2 Remove setting of MAX brightness as the LED framework does this. Signed-off-by: Dan Murphy --- v2 - no changes drivers/leds/Kconfig | 2 +- drivers/leds/leds-lp8860.c | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) -- 2.15.0.124.g7668cbc60 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 318a28fd58fe..ac4d9d8bf96b 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -347,7 +347,7 @@ config LEDS_LP8788 config LEDS_LP8860 tristate "LED support for the TI LP8860 4 channel LED driver" - depends on LEDS_CLASS && I2C + depends on LEDS_CLASS && I2C && OF select REGMAP_I2C help If you say yes here you get support for the TI LP8860 4 channel diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index 4fed603ee728..e94041e0e693 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -399,7 +399,6 @@ static int lp8860_probe(struct i2c_client *client, led->client = client; led->led_dev.name = led->label; - led->led_dev.max_brightness = LED_FULL; led->led_dev.brightness_set_blocking = lp8860_brightness_set; mutex_init(&led->lock); @@ -426,7 +425,7 @@ static int lp8860_probe(struct i2c_client *client, if (ret) return ret; - ret = led_classdev_register(&client->dev, &led->led_dev); + ret = devm_led_classdev_register(&client->dev, &led->led_dev); if (ret) { dev_err(&client->dev, "led register err: %d\n", ret); return ret; @@ -440,8 +439,6 @@ static int lp8860_remove(struct i2c_client *client) struct lp8860_led *led = i2c_get_clientdata(client); int ret; - led_classdev_unregister(&led->led_dev); - if (led->enable_gpio) gpiod_direction_output(led->enable_gpio, 0); @@ -452,6 +449,8 @@ static int lp8860_remove(struct i2c_client *client) "Failed to disable regulator\n"); } + mutex_destroy(&led->lock); + return 0; } @@ -461,18 +460,16 @@ static const struct i2c_device_id lp8860_id[] = { }; MODULE_DEVICE_TABLE(i2c, lp8860_id); -#ifdef CONFIG_OF static const struct of_device_id of_lp8860_leds_match[] = { { .compatible = "ti,lp8860", }, {}, }; MODULE_DEVICE_TABLE(of, of_lp8860_leds_match); -#endif static struct i2c_driver lp8860_driver = { .driver = { .name = "lp8860", - .of_match_table = of_match_ptr(of_lp8860_leds_match), + .of_match_table = of_lp8860_leds_match, }, .probe = lp8860_probe, .remove = lp8860_remove, @@ -482,4 +479,4 @@ module_i2c_driver(lp8860_driver); MODULE_DESCRIPTION("Texas Instruments LP8860 LED driver"); MODULE_AUTHOR("Dan Murphy "); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2");