Messages in this thread Patch in this message | | | Date | Fri, 4 Mar 2022 19:47:36 +0100 | From | Greg Kroah-Hartman <> | 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@google.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@google.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
| |