Skip to content

Commit

Permalink
leds: apu: drop profile field from priv data
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jacek Anaszewski <[email protected]>
  • Loading branch information
metux authored and jacek-anaszewski committed Jul 22, 2019
1 parent 08e8382 commit cc92e3c
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions drivers/leds/leds-apu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cc92e3c

Please sign in to comment.