From patchwork Mon Jun 22 18:59:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 191380 Delivered-To: patch@linaro.org Received: by 2002:a54:3249:0:0:0:0:0 with SMTP id g9csp422898ecs; Mon, 22 Jun 2020 12:00:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJTiG+2NrKHwE78rV3nDW0RiKYOqDR36nC31RgJLNHIrm5gK6sl+kYnNaErW4c3Lg5ZBzt X-Received: by 2002:a50:fd07:: with SMTP id i7mr676915eds.221.1592852457011; Mon, 22 Jun 2020 12:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592852457; cv=none; d=google.com; s=arc-20160816; b=XBou/Nq0+89QNQ8UJUPjAYMF0u1A1iJELYVfM4mjh+LxDyCBPTkbhHDL184/l0RKop k5fgqnSUBoHs3ghhMSj/XWmCHgTYVMVeKie+Q121xyBVCn0KLoCkpnC3k6LRKdjtvlRa qoTIVWwAhuK4dvMWBAoTHerWn+yVcB6BFC8ydlp0QQwM3xslzYbl3KofrQEJczceRQCv BGmlIUB306D3MA1Dk/a0fD2kd5tH7Q8AJcfx6u4Oc3ozfZITp4yh89qcn6DDB5OFYlnd WoAJI6SQwr68jFDUpnIQf/HKujld9qVfmk2XBtDUYQbGq6bl4AyscHoD4QG2+LnGoSLG JpSQ== 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=wCZ4MMAr4l2mgIibN19UwQ6B7f7fRNfZT+ZnfSiiaXc=; b=NEuC0j2sLAzH2gJIDMk5rlGiXbtTfzWi+Qsp30xZxij3TS6WCyfi7Uqd+hSjv3jL0i RprTnHhTlz9SPvxcPPsIvlZCbCJyeWyQ5BkJXfRjPye02NzSBTV1a3/WH6bLFmVq3hOR espfE5xBG9B1uhYG+7/E81n8Dza4EIB0Jec35i8DmRN0qhMOEv5hoQXxfWGGA1Kyn1uf /5adlWSTYxtudJU7F3+NA2ceuAvN2ul2f1hU1sXAUCUM6ozV5skVWnQ8BcROAyj4bUyW Z0U/0UI2MBxoegozD9XhID/NEnZo997/y4Gu9b/smCFMsCLdqRkYR75uXpBf4isDhgQE 0l6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=eWbfOSoq; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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. [23.128.96.18]) by mx.google.com with ESMTP id w27si10780255edi.519.2020.06.22.12.00.56; Mon, 22 Jun 2020 12:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=eWbfOSoq; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1730625AbgFVTAq (ORCPT + 6 others); Mon, 22 Jun 2020 15:00:46 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:60926 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730350AbgFVS7j (ORCPT ); Mon, 22 Jun 2020 14:59:39 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05MIxUru053509; Mon, 22 Jun 2020 13:59:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592852370; bh=wCZ4MMAr4l2mgIibN19UwQ6B7f7fRNfZT+ZnfSiiaXc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eWbfOSoqkyFriFyj2gsYfVo00dI2lwUGz6UFWSnIhqidLb+TyedeJwaKstdMv82Kp 6A3GFb9XeEbOPiCmqtww6rMeKWsFm0R46P1ujWSt0kgU/KQ+woVb9AaXMsUl6+VojT 07adl9eqcg6xfD1Us9T4XF4ZrTnbKeg3TjHJPcG4= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05MIxUMs038070 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 Jun 2020 13:59:30 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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.1979.3; Mon, 22 Jun 2020 13:59:30 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 22 Jun 2020 13:59:30 -0500 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 05MIxTd9113468; Mon, 22 Jun 2020 13:59:30 -0500 From: Dan Murphy To: , , CC: , , , , Dan Murphy Subject: [PATCH v29 10/16] leds: lp55xx: Convert LED class registration to devm_* Date: Mon, 22 Jun 2020 13:59:13 -0500 Message-ID: <20200622185919.2131-11-dmurphy@ti.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200622185919.2131-1-dmurphy@ti.com> References: <20200622185919.2131-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Convert the LED class registration calls to the LED devm_* registration calls. Acked-by: Jacek Anaszewski Acked-by: Pavel Machek 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.26.2 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;