diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-06-28 10:39:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-06-28 10:39:46 -0700 |
commit | 43bd8a67cd10e9526656e2bc160e52920bd9e43c (patch) | |
tree | efd95e1d1a6cf39de81c5eafc2760fdb019e2247 /drivers/ide/ide-sysfs.c | |
parent | 66d9282523b3228183b14d9f812872dd2620704d (diff) | |
parent | 1af11d098db18bfda5168dc407513726e1b1bdb3 (diff) |
Merge tag 'for-5.14/libata-2021-06-27' of git://git.kernel.dk/linux-block
Pull libata updates from Jens Axboe:
"The big change in this round is that we're finally in a position where
we can sanely remove the old drivers/ide/ code, as libata covers
everything we need by now.
This is exciting for two reasons:
1) we delete a lot of legacy code that doesn't really meet the
standards we have today, and
2) it enables us to clean up various bits in the block layer that
exist only because of the old IDE code.
Outside of that, just a few minor fixes here, fixups for warnings,
etc"
* tag 'for-5.14/libata-2021-06-27' of git://git.kernel.dk/linux-block: (29 commits)
ata: rb532_cf: remove redundant codes
ide: remove the legacy ide driver
m68k: use libata instead of the legacy ide driver
ARM: disable CONFIG_IDE in pxa_defconfig
ARM: disable CONFIG_IDE in footbridge_defconfig
alpha: use libata instead of the legacy ide driver
pata_cypress: add a module option to disable BM-DMA
ata: pata_macio: Avoid overwriting initialised field in 'pata_macio_sht'
ata: pata_serverworks: Avoid overwriting initialised field in 'serverworks_osb4_sht
ata: pata_sc1200: sc1200_sht'Avoid overwriting initialised field in '
ata: pata_cs5530: Avoid overwriting initialised field in 'cs5530_sht'
ata: pata_cs5520: Avoid overwriting initialised field in 'cs5520_sht'
ata: pata_atiixp: Avoid overwriting initialised field in 'atiixp_sht'
ata: sata_nv: Do not over-write initialise fields in 'nv_adma_sht' and 'nv_swncq_sht'
ata: sata_mv: Do not over-write initialise fields in 'mv6_sht'
ata: sata_sil24: Do not over-write initialise fields in 'sil24_sht'
ata: ahci: Ensure initialised fields are not overwritten in AHCI_SHT()
ata: include: libata: Move fields commonly over-written to separate MACRO
ahci: Add support for Dell S140 and later controllers
ata: ahci_sunxi: Disable DIPM
...
Diffstat (limited to 'drivers/ide/ide-sysfs.c')
-rw-r--r-- | drivers/ide/ide-sysfs.c | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/drivers/ide/ide-sysfs.c b/drivers/ide/ide-sysfs.c deleted file mode 100644 index c08a8a0916e2..000000000000 --- a/drivers/ide/ide-sysfs.c +++ /dev/null @@ -1,143 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <linux/kernel.h> -#include <linux/ide.h> - -char *ide_media_string(ide_drive_t *drive) -{ - switch (drive->media) { - case ide_disk: - return "disk"; - case ide_cdrom: - return "cdrom"; - case ide_tape: - return "tape"; - case ide_floppy: - return "floppy"; - case ide_optical: - return "optical"; - default: - return "UNKNOWN"; - } -} - -static ssize_t media_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - ide_drive_t *drive = to_ide_device(dev); - return sprintf(buf, "%s\n", ide_media_string(drive)); -} -static DEVICE_ATTR_RO(media); - -static ssize_t drivename_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - ide_drive_t *drive = to_ide_device(dev); - return sprintf(buf, "%s\n", drive->name); -} -static DEVICE_ATTR_RO(drivename); - -static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - ide_drive_t *drive = to_ide_device(dev); - return sprintf(buf, "ide:m-%s\n", ide_media_string(drive)); -} -static DEVICE_ATTR_RO(modalias); - -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", (char *)&drive->id[ATA_ID_PROD]); -} -static DEVICE_ATTR_RO(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", (char *)&drive->id[ATA_ID_FW_REV]); -} -static DEVICE_ATTR_RO(firmware); - -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", (char *)&drive->id[ATA_ID_SERNO]); -} -static DEVICE_ATTR(serial, 0400, serial_show, NULL); - -static DEVICE_ATTR(unload_heads, 0644, ide_park_show, ide_park_store); - -static struct attribute *ide_attrs[] = { - &dev_attr_media.attr, - &dev_attr_drivename.attr, - &dev_attr_modalias.attr, - &dev_attr_model.attr, - &dev_attr_firmware.attr, - &dev_attr_serial.attr, - &dev_attr_unload_heads.attr, - NULL, -}; - -static const struct attribute_group ide_attr_group = { - .attrs = ide_attrs, -}; - -const struct attribute_group *ide_dev_groups[] = { - &ide_attr_group, - NULL, -}; - -static ssize_t store_delete_devices(struct device *portdev, - struct device_attribute *attr, - const char *buf, size_t n) -{ - ide_hwif_t *hwif = dev_get_drvdata(portdev); - - if (strncmp(buf, "1", n)) - return -EINVAL; - - ide_port_unregister_devices(hwif); - - return n; -}; - -static DEVICE_ATTR(delete_devices, S_IWUSR, NULL, store_delete_devices); - -static ssize_t store_scan(struct device *portdev, - struct device_attribute *attr, - const char *buf, size_t n) -{ - ide_hwif_t *hwif = dev_get_drvdata(portdev); - - if (strncmp(buf, "1", n)) - return -EINVAL; - - ide_port_unregister_devices(hwif); - ide_port_scan(hwif); - - return n; -}; - -static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); - -static struct device_attribute *ide_port_attrs[] = { - &dev_attr_delete_devices, - &dev_attr_scan, - NULL -}; - -int ide_sysfs_register_port(ide_hwif_t *hwif) -{ - int i, rc; - - for (i = 0; ide_port_attrs[i]; i++) { - rc = device_create_file(hwif->portdev, ide_port_attrs[i]); - if (rc) - break; - } - - return rc; -} |