[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YiJeyEznIbyfbniV@kroah.com>
Date: Fri, 4 Mar 2022 19:47:36 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Won Chung <wonchung@...gle.com>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Benson Leung <bleung@...omium.org>,
Prashant Malani <pmalani@...omium.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] driver core: Add sysfs support for physical location
of a device
On Fri, Mar 04, 2022 at 06:21:52PM +0000, Won Chung wrote:
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-devices-physical_location
> @@ -0,0 +1,42 @@
> +What: /sys/devices/.../physical_location
> +Date: March 2022
> +Contact: Won Chung <wonchung@...gle.com>
> +Description:
> + This directory contains information on physical location of
> + the device connection point with respect to the system's
> + housing.
> +
> +What: /sys/devices/.../physical_location/panel
> +Date: March 2022
> +Contact: Won Chung <wonchung@...gle.com>
> +Description:
Use tabs everywhere please, stop mixing spaces and tabs in the same file
:(
> +static ssize_t panel_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + const char *panel;
> +
> + switch (dev->location.panel) {
> + case DEVICE_PANEL_TOP:
> + panel = "top";
> + break;
> + case DEVICE_PANEL_BOTTOM:
> + panel = "bottom";
> + break;
> + case DEVICE_PANEL_LEFT:
> + panel = "left";
> + break;
> + case DEVICE_PANEL_RIGHT:
> + panel = "right";
> + break;
> + case DEVICE_PANEL_FRONT:
> + panel = "front";
> + break;
> + case DEVICE_PANEL_BACK:
> + panel = "back";
> + break;
> + default:
> + panel = "unknown";
> + }
> + return sprintf(buf, "%s\n", panel);
Always use sysfs_emit() for new sysfs files.
thanks,
greg k-h
Powered by blists - more mailing lists