Skip to content

Commit 12b87c4

Browse files
SytheZNpastaq
authored andcommitted
fix: conditionally register suspend_mode attribute
1 parent 2506529 commit 12b87c4

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

ayaneo-platform.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,34 @@ static ssize_t suspend_mode_store(struct device *dev, struct device_attribute *a
859859
static DEVICE_ATTR_RW(suspend_mode);
860860

861861
static struct attribute *ayaneo_led_mc_attrs[] = {
862-
&dev_attr_suspend_mode.attr,
862+
NULL,
863863
NULL,
864864
};
865865

866+
static void suspend_mode_register_attr(void)
867+
{
868+
switch (model) {
869+
case air:
870+
case air_1s:
871+
case air_1s_limited:
872+
case air_pro:
873+
case air_plus_mendo:
874+
case geek:
875+
case geek_1s:
876+
case ayaneo_2:
877+
case ayaneo_2s:
878+
case kun:
879+
ayaneo_led_mc_attrs[0] = &dev_attr_suspend_mode.attr;
880+
break;
881+
case air_plus:
882+
case slide:
883+
// Not currently working; do not register
884+
break;
885+
default:
886+
break;
887+
}
888+
}
889+
866890
ATTRIBUTE_GROUPS(ayaneo_led_mc);
867891

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

950974
model = (enum ayaneo_model)match->driver_data;
975+
suspend_mode_register_attr();
951976
ayaneo_led_mc_take_control();
952977

953978
ret = devm_led_classdev_multicolor_register(dev, &ayaneo_led_mc);

0 commit comments

Comments
 (0)