diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-01-02 10:12:48 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-01-02 10:12:48 -0500 |
commit | ebdab07dad3d3a008e519b0a028e1e1ad5ecaef0 (patch) | |
tree | f4ada61ebd953949b14ef75b3bfa8cb16002dc2f /drivers/ide/ide.c | |
parent | 24630dc68a499baec367d24285bc6b92207cc100 (diff) |
ide: move sysfs support to ide-sysfs.c
While at it:
- media_string() -> ide_media_string()
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 72 |
1 files changed, 2 insertions, 70 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index f0f09f702e9c..46a2d4ca812b 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -440,81 +440,13 @@ static int ide_bus_match(struct device *dev, struct device_driver *drv) | |||
440 | return 1; | 440 | return 1; |
441 | } | 441 | } |
442 | 442 | ||
443 | static char *media_string(ide_drive_t *drive) | ||
444 | { | ||
445 | switch (drive->media) { | ||
446 | case ide_disk: | ||
447 | return "disk"; | ||
448 | case ide_cdrom: | ||
449 | return "cdrom"; | ||
450 | case ide_tape: | ||
451 | return "tape"; | ||
452 | case ide_floppy: | ||
453 | return "floppy"; | ||
454 | case ide_optical: | ||
455 | return "optical"; | ||
456 | default: | ||
457 | return "UNKNOWN"; | ||
458 | } | ||
459 | } | ||
460 | |||
461 | static ssize_t media_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
462 | { | ||
463 | ide_drive_t *drive = to_ide_device(dev); | ||
464 | return sprintf(buf, "%s\n", media_string(drive)); | ||
465 | } | ||
466 | |||
467 | static ssize_t drivename_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
468 | { | ||
469 | ide_drive_t *drive = to_ide_device(dev); | ||
470 | return sprintf(buf, "%s\n", drive->name); | ||
471 | } | ||
472 | |||
473 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
474 | { | ||
475 | ide_drive_t *drive = to_ide_device(dev); | ||
476 | return sprintf(buf, "ide:m-%s\n", media_string(drive)); | ||
477 | } | ||
478 | |||
479 | static ssize_t model_show(struct device *dev, struct device_attribute *attr, | ||
480 | char *buf) | ||
481 | { | ||
482 | ide_drive_t *drive = to_ide_device(dev); | ||
483 | return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_PROD]); | ||
484 | } | ||
485 | |||
486 | static ssize_t firmware_show(struct device *dev, struct device_attribute *attr, | ||
487 | char *buf) | ||
488 | { | ||
489 | ide_drive_t *drive = to_ide_device(dev); | ||
490 | return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_FW_REV]); | ||
491 | } | ||
492 | |||
493 | static ssize_t serial_show(struct device *dev, struct device_attribute *attr, | ||
494 | char *buf) | ||
495 | { | ||
496 | ide_drive_t *drive = to_ide_device(dev); | ||
497 | return sprintf(buf, "%s\n", (char *)&drive->id[ATA_ID_SERNO]); | ||
498 | } | ||
499 | |||
500 | static struct device_attribute ide_dev_attrs[] = { | ||
501 | __ATTR_RO(media), | ||
502 | __ATTR_RO(drivename), | ||
503 | __ATTR_RO(modalias), | ||
504 | __ATTR_RO(model), | ||
505 | __ATTR_RO(firmware), | ||
506 | __ATTR(serial, 0400, serial_show, NULL), | ||
507 | __ATTR(unload_heads, 0644, ide_park_show, ide_park_store), | ||
508 | __ATTR_NULL | ||
509 | }; | ||
510 | |||
511 | static int ide_uevent(struct device *dev, struct kobj_uevent_env *env) | 443 | static int ide_uevent(struct device *dev, struct kobj_uevent_env *env) |
512 | { | 444 | { |
513 | ide_drive_t *drive = to_ide_device(dev); | 445 | ide_drive_t *drive = to_ide_device(dev); |
514 | 446 | ||
515 | add_uevent_var(env, "MEDIA=%s", media_string(drive)); | 447 | add_uevent_var(env, "MEDIA=%s", ide_media_string(drive)); |
516 | add_uevent_var(env, "DRIVENAME=%s", drive->name); | 448 | add_uevent_var(env, "DRIVENAME=%s", drive->name); |
517 | add_uevent_var(env, "MODALIAS=ide:m-%s", media_string(drive)); | 449 | add_uevent_var(env, "MODALIAS=ide:m-%s", ide_media_string(drive)); |
518 | return 0; | 450 | return 0; |
519 | } | 451 | } |
520 | 452 | ||