]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: allow device drivers to specify per-device type /proc settings
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 17 Oct 2008 16:09:13 +0000 (18:09 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 17 Oct 2008 16:09:13 +0000 (18:09 +0200)
Turn ide_driver_t's 'proc' field into ->proc_entries method
(and also 'settings' field into ->proc_devsets method).  Then
update all device drivers accordingly.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c
drivers/ide/ide-gd-floppy.c
drivers/ide/ide-gd.c
drivers/ide/ide-proc.c
drivers/ide/ide-tape.c
drivers/scsi/ide-scsi.c
include/linux/ide.h

index 2f4cc10391e5e9ebadf4990ed7b1aefaf6ff54a4..32073666b9caf0c9ee96e48073480869da90c80a 100644 (file)
@@ -1908,6 +1908,16 @@ static const struct ide_proc_devset idecd_settings[] = {
        IDE_PROC_DEVSET(dsc_overlap, 0, 1),
        { 0 },
 };
+
+static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
+{
+       return idecd_proc;
+}
+
+static const struct ide_proc_devset *ide_cd_proc_devsets(ide_drive_t *drive)
+{
+       return idecd_settings;
+}
 #endif
 
 static const struct cd_list_entry ide_cd_quirks_list[] = {
@@ -2069,8 +2079,8 @@ static ide_driver_t ide_cdrom_driver = {
        .end_request            = ide_end_request,
        .error                  = __ide_error,
 #ifdef CONFIG_IDE_PROC_FS
-       .proc                   = idecd_proc,
-       .settings               = idecd_settings,
+       .proc_entries           = ide_cd_proc_entries,
+       .proc_devsets           = ide_cd_proc_devsets,
 #endif
 };
 
index 9862534187946f0a02fd10f3254313f96d67519a..082800b9a558d3b1f86fe9af05efbb3bd4b40d66 100644 (file)
@@ -77,6 +77,18 @@ static void ide_disk_release(struct kref *kref)
        kfree(idkp);
 }
 
+#ifdef CONFIG_IDE_PROC_FS
+static ide_proc_entry_t *ide_floppy_proc_entries(ide_drive_t *drive)
+{
+       return ide_floppy_proc;
+}
+
+static const struct ide_proc_devset *ide_floppy_proc_devsets(ide_drive_t *drive)
+{
+       return ide_floppy_settings;
+}
+#endif
+
 static ide_driver_t ide_gd_driver = {
        .gen_driver = {
                .owner          = THIS_MODULE,
@@ -90,8 +102,8 @@ static ide_driver_t ide_gd_driver = {
        .end_request            = ide_floppy_end_request,
        .error                  = __ide_error,
 #ifdef CONFIG_IDE_PROC_FS
-       .proc                   = ide_floppy_proc,
-       .settings               = ide_floppy_settings,
+       .proc_entries           = ide_floppy_proc_entries,
+       .proc_devsets           = ide_floppy_proc_devsets,
 #endif
 };
 
index c08500270b9ddd925a712f8337cf59eee8f151bd..a3d4ad7db2af54fcec26d649705e2a615852c7b2 100644 (file)
@@ -119,6 +119,18 @@ static void ide_gd_shutdown(ide_drive_t *drive)
        drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND);
 }
 
+#ifdef CONFIG_IDE_PROC_FS
+static ide_proc_entry_t *ide_disk_proc_entries(ide_drive_t *drive)
+{
+       return ide_disk_proc;
+}
+
+static const struct ide_proc_devset *ide_disk_proc_devsets(ide_drive_t *drive)
+{
+       return ide_disk_settings;
+}
+#endif
+
 static ide_driver_t ide_gd_driver = {
        .gen_driver = {
                .owner          = THIS_MODULE,
@@ -134,8 +146,8 @@ static ide_driver_t ide_gd_driver = {
        .end_request            = ide_end_request,
        .error                  = __ide_error,
 #ifdef CONFIG_IDE_PROC_FS
-       .proc                   = ide_disk_proc,
-       .settings               = ide_disk_settings,
+       .proc_entries           = ide_disk_proc_entries,
+       .proc_devsets           = ide_disk_proc_devsets,
 #endif
 };
 
index b26926487cc03f907e8e1798cdf6f0323027391e..c31d0dd7a5322aa56355462db58a213c3a3d9a63 100644 (file)
@@ -567,10 +567,10 @@ static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t
 void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver)
 {
        mutex_lock(&ide_setting_mtx);
-       drive->settings = driver->settings;
+       drive->settings = driver->proc_devsets(drive);
        mutex_unlock(&ide_setting_mtx);
 
-       ide_add_proc_entries(drive->proc, driver->proc, drive);
+       ide_add_proc_entries(drive->proc, driver->proc_entries(drive), drive);
 }
 
 EXPORT_SYMBOL(ide_proc_register_driver);
@@ -591,7 +591,7 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
 {
        unsigned long flags;
 
-       ide_remove_proc_entries(drive->proc, driver->proc);
+       ide_remove_proc_entries(drive->proc, driver->proc_entries(drive));
 
        mutex_lock(&ide_setting_mtx);
        spin_lock_irqsave(&ide_lock, flags);
index a99e28f4515642dfa882f88d00b1e2f711b183b1..b2b2e5e8d38ebf499ec78ffd48df02d2b88496f9 100644 (file)
@@ -2298,6 +2298,16 @@ static ide_proc_entry_t idetape_proc[] = {
        { "name",       S_IFREG|S_IRUGO,        proc_idetape_read_name, NULL },
        { NULL, 0, NULL, NULL }
 };
+
+static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive)
+{
+       return idetape_proc;
+}
+
+static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)
+{
+       return idetape_settings;
+}
 #endif
 
 static int ide_tape_probe(ide_drive_t *);
@@ -2315,8 +2325,8 @@ static ide_driver_t idetape_driver = {
        .end_request            = idetape_end_request,
        .error                  = __ide_error,
 #ifdef CONFIG_IDE_PROC_FS
-       .proc                   = idetape_proc,
-       .settings               = idetape_settings,
+       .proc_entries           = ide_tape_proc_entries,
+       .proc_devsets           = ide_tape_proc_devsets,
 #endif
 };
 
index 740bad435995268112883ff77c61af58e93ce8b6..afc96e844a25d84cc45dafa7175cea1dc7b86101 100644 (file)
@@ -343,6 +343,11 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r
 }
 
 #ifdef CONFIG_IDE_PROC_FS
+static ide_proc_entry_t idescsi_proc[] = {
+       { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL },
+       { NULL, 0, NULL, NULL }
+};
+
 #define ide_scsi_devset_get(name, field) \
 static int get_##name(ide_drive_t *drive) \
 { \
@@ -378,6 +383,16 @@ static const struct ide_proc_devset idescsi_settings[] = {
        IDE_PROC_DEVSET(transform, 0,    3),
        { 0 },
 };
+
+static ide_proc_entry_t *ide_scsi_proc_entries(ide_drive_t *drive)
+{
+       return idescsi_proc;
+}
+
+static const struct ide_proc_devset *ide_scsi_proc_devsets(ide_drive_t *drive)
+{
+       return idescsi_settings;
+}
 #endif
 
 /*
@@ -419,13 +434,6 @@ static void ide_scsi_remove(ide_drive_t *drive)
 
 static int ide_scsi_probe(ide_drive_t *);
 
-#ifdef CONFIG_IDE_PROC_FS
-static ide_proc_entry_t idescsi_proc[] = {
-       { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL },
-       { NULL, 0, NULL, NULL }
-};
-#endif
-
 static ide_driver_t idescsi_driver = {
        .gen_driver = {
                .owner          = THIS_MODULE,
@@ -439,8 +447,8 @@ static ide_driver_t idescsi_driver = {
        .end_request            = idescsi_end_request,
        .error                  = idescsi_atapi_error,
 #ifdef CONFIG_IDE_PROC_FS
-       .proc                   = idescsi_proc,
-       .settings               = idescsi_settings,
+       .proc_entries           = ide_scsi_proc_entries,
+       .proc_devsets           = ide_scsi_proc_devsets,
 #endif
 };
 
index ba51a93fa5471c2a95b224894b8db94c231cf8c2..488808891acbe6f614ca02653506d2fb0697b7e7 100644 (file)
@@ -1120,8 +1120,8 @@ struct ide_driver_s {
        void            (*resume)(ide_drive_t *);
        void            (*shutdown)(ide_drive_t *);
 #ifdef CONFIG_IDE_PROC_FS
-       ide_proc_entry_t                *proc;
-       const struct ide_proc_devset    *settings;
+       ide_proc_entry_t *              (*proc_entries)(ide_drive_t *);
+       const struct ide_proc_devset *  (*proc_devsets)(ide_drive_t *);
 #endif
 };