aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-17 12:09:13 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-17 12:09:13 -0400
commit79cb380397c834a35952d8497651d93b543ef968 (patch)
treecfeb4b1c69327df9f8885d18fa0d0ef3e547cce4
parent9a6eb74d07f9152dd0e0ea551e878e869b8d2fc1 (diff)
ide: allow device drivers to specify per-device type /proc settings
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>
-rw-r--r--drivers/ide/ide-cd.c14
-rw-r--r--drivers/ide/ide-gd-floppy.c16
-rw-r--r--drivers/ide/ide-gd.c16
-rw-r--r--drivers/ide/ide-proc.c6
-rw-r--r--drivers/ide/ide-tape.c14
-rw-r--r--drivers/scsi/ide-scsi.c26
-rw-r--r--include/linux/ide.h4
7 files changed, 74 insertions, 22 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2f4cc10391e5..32073666b9ca 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1908,6 +1908,16 @@ static const struct ide_proc_devset idecd_settings[] = {
1908 IDE_PROC_DEVSET(dsc_overlap, 0, 1), 1908 IDE_PROC_DEVSET(dsc_overlap, 0, 1),
1909 { 0 }, 1909 { 0 },
1910}; 1910};
1911
1912static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
1913{
1914 return idecd_proc;
1915}
1916
1917static const struct ide_proc_devset *ide_cd_proc_devsets(ide_drive_t *drive)
1918{
1919 return idecd_settings;
1920}
1911#endif 1921#endif
1912 1922
1913static const struct cd_list_entry ide_cd_quirks_list[] = { 1923static const struct cd_list_entry ide_cd_quirks_list[] = {
@@ -2069,8 +2079,8 @@ static ide_driver_t ide_cdrom_driver = {
2069 .end_request = ide_end_request, 2079 .end_request = ide_end_request,
2070 .error = __ide_error, 2080 .error = __ide_error,
2071#ifdef CONFIG_IDE_PROC_FS 2081#ifdef CONFIG_IDE_PROC_FS
2072 .proc = idecd_proc, 2082 .proc_entries = ide_cd_proc_entries,
2073 .settings = idecd_settings, 2083 .proc_devsets = ide_cd_proc_devsets,
2074#endif 2084#endif
2075}; 2085};
2076 2086
diff --git a/drivers/ide/ide-gd-floppy.c b/drivers/ide/ide-gd-floppy.c
index 986253418794..082800b9a558 100644
--- a/drivers/ide/ide-gd-floppy.c
+++ b/drivers/ide/ide-gd-floppy.c
@@ -77,6 +77,18 @@ static void ide_disk_release(struct kref *kref)
77 kfree(idkp); 77 kfree(idkp);
78} 78}
79 79
80#ifdef CONFIG_IDE_PROC_FS
81static ide_proc_entry_t *ide_floppy_proc_entries(ide_drive_t *drive)
82{
83 return ide_floppy_proc;
84}
85
86static const struct ide_proc_devset *ide_floppy_proc_devsets(ide_drive_t *drive)
87{
88 return ide_floppy_settings;
89}
90#endif
91
80static ide_driver_t ide_gd_driver = { 92static ide_driver_t ide_gd_driver = {
81 .gen_driver = { 93 .gen_driver = {
82 .owner = THIS_MODULE, 94 .owner = THIS_MODULE,
@@ -90,8 +102,8 @@ static ide_driver_t ide_gd_driver = {
90 .end_request = ide_floppy_end_request, 102 .end_request = ide_floppy_end_request,
91 .error = __ide_error, 103 .error = __ide_error,
92#ifdef CONFIG_IDE_PROC_FS 104#ifdef CONFIG_IDE_PROC_FS
93 .proc = ide_floppy_proc, 105 .proc_entries = ide_floppy_proc_entries,
94 .settings = ide_floppy_settings, 106 .proc_devsets = ide_floppy_proc_devsets,
95#endif 107#endif
96}; 108};
97 109
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index c08500270b9d..a3d4ad7db2af 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -119,6 +119,18 @@ static void ide_gd_shutdown(ide_drive_t *drive)
119 drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND); 119 drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND);
120} 120}
121 121
122#ifdef CONFIG_IDE_PROC_FS
123static ide_proc_entry_t *ide_disk_proc_entries(ide_drive_t *drive)
124{
125 return ide_disk_proc;
126}
127
128static const struct ide_proc_devset *ide_disk_proc_devsets(ide_drive_t *drive)
129{
130 return ide_disk_settings;
131}
132#endif
133
122static ide_driver_t ide_gd_driver = { 134static ide_driver_t ide_gd_driver = {
123 .gen_driver = { 135 .gen_driver = {
124 .owner = THIS_MODULE, 136 .owner = THIS_MODULE,
@@ -134,8 +146,8 @@ static ide_driver_t ide_gd_driver = {
134 .end_request = ide_end_request, 146 .end_request = ide_end_request,
135 .error = __ide_error, 147 .error = __ide_error,
136#ifdef CONFIG_IDE_PROC_FS 148#ifdef CONFIG_IDE_PROC_FS
137 .proc = ide_disk_proc, 149 .proc_entries = ide_disk_proc_entries,
138 .settings = ide_disk_settings, 150 .proc_devsets = ide_disk_proc_devsets,
139#endif 151#endif
140}; 152};
141 153
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index b26926487cc0..c31d0dd7a532 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -567,10 +567,10 @@ static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t
567void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) 567void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver)
568{ 568{
569 mutex_lock(&ide_setting_mtx); 569 mutex_lock(&ide_setting_mtx);
570 drive->settings = driver->settings; 570 drive->settings = driver->proc_devsets(drive);
571 mutex_unlock(&ide_setting_mtx); 571 mutex_unlock(&ide_setting_mtx);
572 572
573 ide_add_proc_entries(drive->proc, driver->proc, drive); 573 ide_add_proc_entries(drive->proc, driver->proc_entries(drive), drive);
574} 574}
575 575
576EXPORT_SYMBOL(ide_proc_register_driver); 576EXPORT_SYMBOL(ide_proc_register_driver);
@@ -591,7 +591,7 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
591{ 591{
592 unsigned long flags; 592 unsigned long flags;
593 593
594 ide_remove_proc_entries(drive->proc, driver->proc); 594 ide_remove_proc_entries(drive->proc, driver->proc_entries(drive));
595 595
596 mutex_lock(&ide_setting_mtx); 596 mutex_lock(&ide_setting_mtx);
597 spin_lock_irqsave(&ide_lock, flags); 597 spin_lock_irqsave(&ide_lock, flags);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a99e28f45156..b2b2e5e8d38e 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2298,6 +2298,16 @@ static ide_proc_entry_t idetape_proc[] = {
2298 { "name", S_IFREG|S_IRUGO, proc_idetape_read_name, NULL }, 2298 { "name", S_IFREG|S_IRUGO, proc_idetape_read_name, NULL },
2299 { NULL, 0, NULL, NULL } 2299 { NULL, 0, NULL, NULL }
2300}; 2300};
2301
2302static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive)
2303{
2304 return idetape_proc;
2305}
2306
2307static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)
2308{
2309 return idetape_settings;
2310}
2301#endif 2311#endif
2302 2312
2303static int ide_tape_probe(ide_drive_t *); 2313static int ide_tape_probe(ide_drive_t *);
@@ -2315,8 +2325,8 @@ static ide_driver_t idetape_driver = {
2315 .end_request = idetape_end_request, 2325 .end_request = idetape_end_request,
2316 .error = __ide_error, 2326 .error = __ide_error,
2317#ifdef CONFIG_IDE_PROC_FS 2327#ifdef CONFIG_IDE_PROC_FS
2318 .proc = idetape_proc, 2328 .proc_entries = ide_tape_proc_entries,
2319 .settings = idetape_settings, 2329 .proc_devsets = ide_tape_proc_devsets,
2320#endif 2330#endif
2321}; 2331};
2322 2332
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 740bad435995..afc96e844a25 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -343,6 +343,11 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r
343} 343}
344 344
345#ifdef CONFIG_IDE_PROC_FS 345#ifdef CONFIG_IDE_PROC_FS
346static ide_proc_entry_t idescsi_proc[] = {
347 { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL },
348 { NULL, 0, NULL, NULL }
349};
350
346#define ide_scsi_devset_get(name, field) \ 351#define ide_scsi_devset_get(name, field) \
347static int get_##name(ide_drive_t *drive) \ 352static int get_##name(ide_drive_t *drive) \
348{ \ 353{ \
@@ -378,6 +383,16 @@ static const struct ide_proc_devset idescsi_settings[] = {
378 IDE_PROC_DEVSET(transform, 0, 3), 383 IDE_PROC_DEVSET(transform, 0, 3),
379 { 0 }, 384 { 0 },
380}; 385};
386
387static ide_proc_entry_t *ide_scsi_proc_entries(ide_drive_t *drive)
388{
389 return idescsi_proc;
390}
391
392static const struct ide_proc_devset *ide_scsi_proc_devsets(ide_drive_t *drive)
393{
394 return idescsi_settings;
395}
381#endif 396#endif
382 397
383/* 398/*
@@ -419,13 +434,6 @@ static void ide_scsi_remove(ide_drive_t *drive)
419 434
420static int ide_scsi_probe(ide_drive_t *); 435static int ide_scsi_probe(ide_drive_t *);
421 436
422#ifdef CONFIG_IDE_PROC_FS
423static ide_proc_entry_t idescsi_proc[] = {
424 { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL },
425 { NULL, 0, NULL, NULL }
426};
427#endif
428
429static ide_driver_t idescsi_driver = { 437static ide_driver_t idescsi_driver = {
430 .gen_driver = { 438 .gen_driver = {
431 .owner = THIS_MODULE, 439 .owner = THIS_MODULE,
@@ -439,8 +447,8 @@ static ide_driver_t idescsi_driver = {
439 .end_request = idescsi_end_request, 447 .end_request = idescsi_end_request,
440 .error = idescsi_atapi_error, 448 .error = idescsi_atapi_error,
441#ifdef CONFIG_IDE_PROC_FS 449#ifdef CONFIG_IDE_PROC_FS
442 .proc = idescsi_proc, 450 .proc_entries = ide_scsi_proc_entries,
443 .settings = idescsi_settings, 451 .proc_devsets = ide_scsi_proc_devsets,
444#endif 452#endif
445}; 453};
446 454
diff --git a/include/linux/ide.h b/include/linux/ide.h
index ba51a93fa547..488808891acb 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1120,8 +1120,8 @@ struct ide_driver_s {
1120 void (*resume)(ide_drive_t *); 1120 void (*resume)(ide_drive_t *);
1121 void (*shutdown)(ide_drive_t *); 1121 void (*shutdown)(ide_drive_t *);
1122#ifdef CONFIG_IDE_PROC_FS 1122#ifdef CONFIG_IDE_PROC_FS
1123 ide_proc_entry_t *proc; 1123 ide_proc_entry_t * (*proc_entries)(ide_drive_t *);
1124 const struct ide_proc_devset *settings; 1124 const struct ide_proc_devset * (*proc_devsets)(ide_drive_t *);
1125#endif 1125#endif
1126}; 1126};
1127 1127