From patchwork Mon Nov 4 12:37:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 178411 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1427325ilf; Mon, 4 Nov 2019 04:39:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwEUvdljgUIJlth59SXSkOxgRgqEMi/mDBNJfFPof0451va5SnPcyfv0oVn/TtUcr7v9DPK X-Received: by 2002:a17:906:86d5:: with SMTP id j21mr23378049ejy.219.1572871154048; Mon, 04 Nov 2019 04:39:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572871154; cv=none; d=google.com; s=arc-20160816; b=Ny2GrqAJh1DvZ+G2U7NvpfuyiXfoinl2C7WgMEZuBfR+TM8hB3kBDyu+SLHUxMEDUD qHfrkJ4P9/ZVBAFuxhnoezKA3/TgYqa6ESWfQwj28HubJNdcAycEOzeZfJOuKTWbT6vH GPr1pZSq8U/pSKhsGgwnZ7TyG6zM6Kfz2AdrIBQDYW5AQmcehi8owrkR1Vz7OvEvOSnb jGb8/orR2vm3swRFge0+LjBYH4rAc/GOowJg0LAzbDwIehV4ttVesp8dS7wDyy/ZM49b PRzVqcmhfgUMT5frtvnUgXEg4hqNmPu8nILKtjANE46tOyBJ9OvfQMAl4Vgir0uJPjJB KyfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ux3NdveofEotm2m8GimOFkGu48EX+3UN3KXdUkP71GQ=; b=ShPbp3Ek814iDdMcjMbmg/T6eXcRd1e/PQ4rASiXkj+a0ub8t1upYWIHhK1RUmkUyl McrwEkVMKdBfCztaer2rkdNsno4BLxbgDhh/tvl9BuGPhniqrYeJAnnavYJqh9YtPbHs Z6ajW3ob5nEJK2kjJGe5mIKDnTk6tH3xkhl9xQbEpxFiVW0L53ZD4G6qkmVETw4/b3R1 xBIP0idJGk5KWC6vfL5drYw14iXxWD77rszl5HJCo0P6wRZPO+/yw8L4FVJDgrPAmtiP LLYihPmhqYTBeR8+xKMPiN9DTNf8l6oXSuXGio3xyLrlSl70lyEBLws81dQ7eUeOnUIi HJ+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=eGgjhL5p; 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 n2si4774393ejx.38.2019.11.04.04.39.13; Mon, 04 Nov 2019 04:39:14 -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=eGgjhL5p; 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 S1729137AbfKDMjN (ORCPT + 1 other); Mon, 4 Nov 2019 07:39:13 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:49354 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727267AbfKDMjL (ORCPT ); Mon, 4 Nov 2019 07:39:11 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id xA4Cd8gI041147; Mon, 4 Nov 2019 06:39:08 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572871148; bh=ux3NdveofEotm2m8GimOFkGu48EX+3UN3KXdUkP71GQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eGgjhL5pwDgr4J3ZpHNh7YeIghAes4kqMv4q2AnfBqghBa75VcMqkBfI3Sntgv7cN tbxco3WxJHeDKPMW2NN9NyCW0tIIT1C4cjBBll/T9DOCWtVaVDLkepJhZHMcLyVS8/ Z1uyN0sQEz9w+W5jATPLmz0imJ1YAJigg7OvgodY= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA4Cd88T068836; Mon, 4 Nov 2019 06:39:08 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 4 Nov 2019 06:38:53 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 4 Nov 2019 06:38:53 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA4Cd89D086465; Mon, 4 Nov 2019 06:39:08 -0600 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v16 12/19] leds: lp55xx: Convert LED class registration to devm_* Date: Mon, 4 Nov 2019 06:37:00 -0600 Message-ID: <20191104123707.31930-13-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191104123707.31930-1-dmurphy@ti.com> References: <20191104123707.31930-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 Convert the LED class registration calls to the LED devm_* registration calls. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5521.c | 9 +++------ drivers/leds/leds-lp5523.c | 9 +++------ drivers/leds/leds-lp5562.c | 9 +++------ drivers/leds/leds-lp55xx-common.c | 15 +-------------- drivers/leds/leds-lp55xx-common.h | 2 -- drivers/leds/leds-lp8501.c | 9 +++------ 6 files changed, 13 insertions(+), 40 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6f0272249dc8..6d2163c0f625 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -541,19 +541,17 @@ static int lp5521_probe(struct i2c_client *client, ret = lp55xx_register_leds(led, chip); if (ret) - goto err_register_leds; + goto err_out; ret = lp55xx_register_sysfs(chip); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); - goto err_register_sysfs; + goto err_out; } return 0; -err_register_sysfs: - lp55xx_unregister_leds(led, chip); -err_register_leds: +err_out: lp55xx_deinit_device(chip); err_init: return ret; @@ -566,7 +564,6 @@ static int lp5521_remove(struct i2c_client *client) lp5521_stop_all_engines(chip); lp55xx_unregister_sysfs(chip); - lp55xx_unregister_leds(led, chip); lp55xx_deinit_device(chip); return 0; diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index d0b931a136b9..15e7051392f5 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -908,19 +908,17 @@ static int lp5523_probe(struct i2c_client *client, ret = lp55xx_register_leds(led, chip); if (ret) - goto err_register_leds; + goto err_out; ret = lp55xx_register_sysfs(chip); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); - goto err_register_sysfs; + goto err_out; } return 0; -err_register_sysfs: - lp55xx_unregister_leds(led, chip); -err_register_leds: +err_out: lp55xx_deinit_device(chip); err_init: return ret; @@ -933,7 +931,6 @@ static int lp5523_remove(struct i2c_client *client) lp5523_stop_all_engines(chip); lp55xx_unregister_sysfs(chip); - lp55xx_unregister_leds(led, chip); lp55xx_deinit_device(chip); return 0; diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c index edb57c42e8b1..1c94422408b0 100644 --- a/drivers/leds/leds-lp5562.c +++ b/drivers/leds/leds-lp5562.c @@ -554,19 +554,17 @@ static int lp5562_probe(struct i2c_client *client, ret = lp55xx_register_leds(led, chip); if (ret) - goto err_register_leds; + goto err_out; ret = lp55xx_register_sysfs(chip); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); - goto err_register_sysfs; + goto err_out; } return 0; -err_register_sysfs: - lp55xx_unregister_leds(led, chip); -err_register_leds: +err_out: lp55xx_deinit_device(chip); err_init: return ret; @@ -580,7 +578,6 @@ static int lp5562_remove(struct i2c_client *client) lp5562_stop_engine(chip); lp55xx_unregister_sysfs(chip); - lp55xx_unregister_leds(led, chip); lp55xx_deinit_device(chip); return 0; diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 44ced02b49f9..882ef39e4965 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -181,7 +181,7 @@ static int lp55xx_init_led(struct lp55xx_led *led, led->cdev.name = name; } - ret = led_classdev_register(dev, &led->cdev); + ret = devm_led_classdev_register(dev, &led->cdev); if (ret) { dev_err(dev, "led register err: %d\n", ret); return ret; @@ -490,23 +490,10 @@ int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip) return 0; err_init_led: - lp55xx_unregister_leds(led, chip); return ret; } EXPORT_SYMBOL_GPL(lp55xx_register_leds); -void lp55xx_unregister_leds(struct lp55xx_led *led, struct lp55xx_chip *chip) -{ - int i; - struct lp55xx_led *each; - - for (i = 0; i < chip->num_leds; i++) { - each = led + i; - led_classdev_unregister(&each->cdev); - } -} -EXPORT_SYMBOL_GPL(lp55xx_unregister_leds); - int lp55xx_register_sysfs(struct lp55xx_chip *chip) { struct device *dev = &chip->cl->dev; diff --git a/drivers/leds/leds-lp55xx-common.h b/drivers/leds/leds-lp55xx-common.h index 783ed5103ce5..b9b1041e8143 100644 --- a/drivers/leds/leds-lp55xx-common.h +++ b/drivers/leds/leds-lp55xx-common.h @@ -189,8 +189,6 @@ extern void lp55xx_deinit_device(struct lp55xx_chip *chip); /* common LED class device functions */ extern int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip); -extern void lp55xx_unregister_leds(struct lp55xx_led *led, - struct lp55xx_chip *chip); /* common device attributes functions */ extern int lp55xx_register_sysfs(struct lp55xx_chip *chip); diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c index 2638dbf0e8ac..a58019cdb8c3 100644 --- a/drivers/leds/leds-lp8501.c +++ b/drivers/leds/leds-lp8501.c @@ -344,19 +344,17 @@ static int lp8501_probe(struct i2c_client *client, ret = lp55xx_register_leds(led, chip); if (ret) - goto err_register_leds; + goto err_out; ret = lp55xx_register_sysfs(chip); if (ret) { dev_err(&client->dev, "registering sysfs failed\n"); - goto err_register_sysfs; + goto err_out; } return 0; -err_register_sysfs: - lp55xx_unregister_leds(led, chip); -err_register_leds: +err_out: lp55xx_deinit_device(chip); err_init: return ret; @@ -369,7 +367,6 @@ static int lp8501_remove(struct i2c_client *client) lp8501_stop_engine(chip); lp55xx_unregister_sysfs(chip); - lp55xx_unregister_leds(led, chip); lp55xx_deinit_device(chip); return 0;