Re: [patch 11/11]add 'type' sysfs file for dock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaohua Li <shaohua.li@xxxxxxxxx> writes:

> add a sysfs file to present dock type. Suggested by Holger.
>
> Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>
> ---
>  drivers/acpi/dock.c |   32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> Index: linux/drivers/acpi/dock.c
> ===================================================================
> --- linux.orig/drivers/acpi/dock.c	2008-08-27 10:22:28.000000000 +0800
> +++ linux/drivers/acpi/dock.c	2008-08-27 10:22:32.000000000 +0800
> @@ -902,6 +902,25 @@ static ssize_t show_dock_uid(struct devi
>  }
>  static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
>  
> +static ssize_t show_dock_type(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	struct dock_station *dock_station = *((struct dock_station **)dev->platform_data);

80 chars?

>  /**
>   * dock_add - add a new dock station
>   * @handle: the dock station handle
> @@ -989,6 +1008,18 @@ static int dock_add(acpi_handle handle)
>  		dock_station = NULL;
>  		return ret;
>  	}
> +	ret = device_create_file(&dock_device->dev, &dev_attr_type);
> +	if (ret) {
> +		printk("Error %d adding sysfs file\n", ret);
> +		device_remove_file(&dock_device->dev, &dev_attr_docked);
> +		device_remove_file(&dock_device->dev, &dev_attr_undock);
> +		device_remove_file(&dock_device->dev, &dev_attr_uid);
> +		device_remove_file(&dock_device->dev, &dev_attr_flags);
> +		platform_device_unregister(dock_device);
> +		kfree(dock_station);
> +		dock_station = NULL;
> +		return ret;

I can just see that path breaking (or is it even tested). And it's
not fatal anyways. Best to just printk and ignore.

-Andi

-- 
ak@xxxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux