diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-28 09:55:58 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-05-23 16:02:39 +0100 |
commit | 84a43257f88e48b2a64c10e09d131ef1d3a74df0 (patch) | |
tree | 112acbf452f4324dcea67d86d9f3c0923b28f666 /arch/arm/mach-sa1100/ipaq-sleeve-bus.c | |
parent | 148aac08365c4dfa8156fe8cd5336e64bdeb31a0 (diff) |
ipaq sleeve updates
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100/ipaq-sleeve-bus.c')
-rw-r--r-- | arch/arm/mach-sa1100/ipaq-sleeve-bus.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/arch/arm/mach-sa1100/ipaq-sleeve-bus.c b/arch/arm/mach-sa1100/ipaq-sleeve-bus.c index 9bf3201002b6..31299589d4a9 100644 --- a/arch/arm/mach-sa1100/ipaq-sleeve-bus.c +++ b/arch/arm/mach-sa1100/ipaq-sleeve-bus.c @@ -19,9 +19,17 @@ static ssize_t device_show(struct device *dev, struct device_attribute *attr, ch } static DEVICE_ATTR_RO(device); +static ssize_t description_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct ipaq_option_device *idev = to_ipaq_option_device(dev); + return snprintf(buf, PAGE_SIZE, "%s\n", idev->description); +} +static DEVICE_ATTR_RO(description); + static struct attribute *ipaq_option_sleeve_attrs[] = { - &dev_attr_vendor.attr, + &dev_attr_description.attr, &dev_attr_device.attr, + &dev_attr_vendor.attr, NULL, }; @@ -55,7 +63,8 @@ static int ipaq_option_sleeve_uevent(struct device *dev, struct kobj_uevent_env if (!dev) return -ENODEV; - if (add_uevent_var(env, "MODALIAS=ipaq:v%04Xd%04X", + if (add_uevent_var(env, "DESCRIPTION=%s", idev->description) || + add_uevent_var(env, "MODALIAS=ipaq:v%04Xd%04X", idev->id.vendor, idev->id.device)) return -ENOMEM; @@ -72,12 +81,14 @@ EXPORT_SYMBOL_GPL(ipaq_option_sleeve_bus); static void ipaq_option_release(struct device *dev) { - struct ipaq_option_device *opt_dev = to_ipaq_option_device(dev); + struct ipaq_option_device *idev = to_ipaq_option_device(dev); - kfree(opt_dev); + kfree(idev->description); + kfree(idev); } -int ipaq_option_device_add(struct device *parent, struct ipaq_option_id id) +int ipaq_option_device_add(struct device *parent, struct ipaq_option_id id, + const char *description) { struct ipaq_option_device *idev; @@ -85,6 +96,12 @@ int ipaq_option_device_add(struct device *parent, struct ipaq_option_id id) if (!idev) return -ENOMEM; + idev->description = kstrdup(description, GFP_KERNEL); + if (!idev->description) { + kfree(idev); + return -ENOMEM; + } + idev->id = id; device_initialize(&idev->dev); dev_set_name(&idev->dev, "sleeve"); |