Skip to content

Commit

Permalink
fix: conditionally register suspend_mode attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
SytheZN authored and pastaq committed Jun 8, 2024
1 parent 2506529 commit 12b87c4
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion ayaneo-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,34 @@ static ssize_t suspend_mode_store(struct device *dev, struct device_attribute *a
static DEVICE_ATTR_RW(suspend_mode);

static struct attribute *ayaneo_led_mc_attrs[] = {
&dev_attr_suspend_mode.attr,
NULL,
NULL,
};

static void suspend_mode_register_attr(void)
{
switch (model) {
case air:
case air_1s:
case air_1s_limited:
case air_pro:
case air_plus_mendo:
case geek:
case geek_1s:
case ayaneo_2:
case ayaneo_2s:
case kun:
ayaneo_led_mc_attrs[0] = &dev_attr_suspend_mode.attr;
break;
case air_plus:
case slide:
// Not currently working; do not register
break;
default:
break;
}
}

ATTRIBUTE_GROUPS(ayaneo_led_mc);

struct mc_subled ayaneo_led_mc_subled_info[] = {
Expand Down Expand Up @@ -948,6 +972,7 @@ static int ayaneo_platform_probe(struct platform_device *pdev)
return ret;

model = (enum ayaneo_model)match->driver_data;
suspend_mode_register_attr();
ayaneo_led_mc_take_control();

ret = devm_led_classdev_multicolor_register(dev, &ayaneo_led_mc);
Expand Down

0 comments on commit 12b87c4

Please sign in to comment.