linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
To: linux-kernel@vger.kernel.org
Cc: jacek.anaszewski@gmail.com, pavel@ucw.cz, dmurphy@ti.com,
	linux-leds@vger.kernel.org
Subject: [PATCH 4/6] leds: apu: drop profile field from priv data
Date: Mon, 15 Jul 2019 16:57:31 +0200	[thread overview]
Message-ID: <1563202653-20994-5-git-send-email-info@metux.net> (raw)
In-Reply-To: <1563202653-20994-1-git-send-email-info@metux.net>

From: Enrico Weigelt <info@metux.net>

As this driver now only supports the APU1 boards, we don't need
to handle profiles anymore and just can use the only one global
array directly.

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/leds/leds-apu.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index f79146c..451cb9f 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -69,8 +69,6 @@ struct apu_led_profile {
 struct apu_led_pdata {
 	struct platform_device *pdev;
 	struct apu_led_priv *pled;
-	const struct apu_led_profile *profile;
-	int num_led_instances;
 	spinlock_t lock;
 };
 
@@ -109,24 +107,24 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
 	int err;
 
 	apu_led->pled = devm_kcalloc(dev,
-		apu_led->num_led_instances, sizeof(struct apu_led_priv),
+		ARRAY_SIZE(apu1_led_profile), sizeof(struct apu_led_priv),
 		GFP_KERNEL);
 
 	if (!apu_led->pled)
 		return -ENOMEM;
 
-	for (i = 0; i < apu_led->num_led_instances; i++) {
+	for (i = 0; i < ARRAY_SIZE(apu1_led_profile); i++) {
 		struct apu_led_priv *pled = &apu_led->pled[i];
 		struct led_classdev *led_cdev = &pled->cdev;
 
-		led_cdev->name = apu_led->profile[i].name;
-		led_cdev->brightness = apu_led->profile[i].brightness;
+		led_cdev->name = apu1_led_profile[i].name;
+		led_cdev->brightness = apu1_led_profile[i].brightness;
 		led_cdev->max_brightness = 1;
 		led_cdev->flags = LED_CORE_SUSPENDRESUME;
 		led_cdev->brightness_set = apu1_led_brightness_set;
 
 		pled->param.addr = devm_ioremap(dev,
-				apu_led->profile[i].offset, APU1_IOSIZE);
+				apu1_led_profile[i].offset, APU1_IOSIZE);
 		if (!pled->param.addr) {
 			err = -ENOMEM;
 			goto error;
@@ -136,7 +134,7 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
 		if (err)
 			goto error;
 
-		apu1_led_brightness_set(led_cdev, apu_led->profile[i].brightness);
+		apu1_led_brightness_set(led_cdev, apu1_led_profile[i].brightness);
 	}
 
 	return 0;
@@ -157,9 +155,6 @@ static int __init apu_led_probe(struct platform_device *pdev)
 
 	apu_led->pdev = pdev;
 
-	apu_led->profile = apu1_led_profile;
-	apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile);
-
 	spin_lock_init(&apu_led->lock);
 	return apu_led_config(&pdev->dev, apu_led);
 }
@@ -204,7 +199,7 @@ static void __exit apu_led_exit(void)
 {
 	int i;
 
-	for (i = 0; i < apu_led->num_led_instances; i++)
+	for (i = 0; i < ARRAY_SIZE(apu1_led_profile); i++)
 		led_classdev_unregister(&apu_led->pled[i].cdev);
 
 	platform_device_unregister(apu_led->pdev);
-- 
1.9.1


  parent reply	other threads:[~2019-07-15 14:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 14:57 leds: apu: drop obsolete support for apu>=2 Enrico Weigelt, metux IT consult
2019-07-15 14:57 ` [PATCH 1/6] leds: apu: drop superseeded apu2/3 led support Enrico Weigelt, metux IT consult
2019-07-16 19:30   ` Pavel Machek
2019-07-17 14:28     ` Enrico Weigelt, metux IT consult
2019-07-15 14:57 ` [PATCH 2/6] leds: apu: drop enum_apu_led_platform_types Enrico Weigelt, metux IT consult
2019-07-16 19:25   ` Pavel Machek
2019-07-15 14:57 ` [PATCH 3/6] leds: apu: drop iosize field from priv data Enrico Weigelt, metux IT consult
2019-07-16 19:25   ` Pavel Machek
2019-07-15 14:57 ` Enrico Weigelt, metux IT consult [this message]
2019-07-16 19:26   ` [PATCH 4/6] leds: apu: drop profile " Pavel Machek
2019-07-15 14:57 ` [PATCH 5/6] leds: apu: fix error on probing failure Enrico Weigelt, metux IT consult
2019-07-16 19:28   ` Pavel Machek
2019-07-17 14:29     ` Enrico Weigelt, metux IT consult
2019-07-17 16:37       ` Jacek Anaszewski
2019-07-22 12:08         ` [PATCH v2] leds: apu: fix error message " Enrico Weigelt, metux IT consult
2019-07-22 12:26           ` Pavel Machek
2019-07-15 14:57 ` [PATCH 6/6] leds: apu: add pr_fmt prefix for better log output Enrico Weigelt, metux IT consult
2019-07-16 19:28   ` Pavel Machek
2019-07-22 20:12 ` leds: apu: drop obsolete support for apu>=2 Jacek Anaszewski
2019-08-29  9:08   ` Enrico Weigelt, metux IT consult
2019-08-29 19:51     ` Jacek Anaszewski
2019-09-24 12:42       ` Enrico Weigelt, metux IT consult

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1563202653-20994-5-git-send-email-info@metux.net \
    --to=info@metux.net \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).