From: Bartlomiej Zolnierkiewicz Date: Wed, 12 Dec 2007 22:31:58 +0000 (+0100) Subject: ide: add /sys/bus/ide/devices/*/{model,firmware,serial} sysfs entries X-Git-Tag: v2.6.24-rc6~61^2~8 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e11b9035a47da66fcd4bafd3a5f6b14f51ca667e;p=linux-2.6 ide: add /sys/bus/ide/devices/*/{model,firmware,serial} sysfs entries Cc: Dan Kegel Cc: Kay Sievers Cc: Xavier Bestel Cc: Andrey Borzenkov Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 674a65c1a1..85740ae5d6 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -1670,10 +1670,34 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, return sprintf(buf, "ide:m-%s\n", media_string(drive)); } +static ssize_t model_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + ide_drive_t *drive = to_ide_device(dev); + return sprintf(buf, "%s\n", drive->id->model); +} + +static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + ide_drive_t *drive = to_ide_device(dev); + return sprintf(buf, "%s\n", drive->id->fw_rev); +} + +static ssize_t serial_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + ide_drive_t *drive = to_ide_device(dev); + return sprintf(buf, "%s\n", drive->id->serial_no); +} + static struct device_attribute ide_dev_attrs[] = { __ATTR_RO(media), __ATTR_RO(drivename), __ATTR_RO(modalias), + __ATTR_RO(model), + __ATTR_RO(firmware), + __ATTR(serial, 0400, serial_show, NULL), __ATTR_NULL };