diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:10 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-05-09 18:01:10 -0400 |
commit | 7662d046df09e80680b77b68de896beab45e675e (patch) | |
tree | ea2281c59399b3867fb37e1005a0f0e0d2170c5d /drivers/scsi | |
parent | 1497943ee692aa7519fa972d0e3a339649bf3a96 (diff) |
ide: move IDE settings handling to ide-proc.c
* move
__ide_add_setting()
ide_add_setting()
__ide_remove_setting()
auto_remove_settings()
ide_find_setting_by_name()
ide_read_setting()
ide_write_setting()
set_xfer_rate()
ide_add_generic_settings()
ide_register_subdriver()
ide_unregister_subdriver()
from ide.c to ide-proc.c
* set_{io_32bit,pio_mode,using_dma}() cannot be marked static now, fix it
* rename ide_[un]register_subdriver() to ide_proc_[un]register_driver(),
update device drivers to use new names
* add CONFIG_IDE_PROC_FS=n versions of ide_proc_[un]register_driver()
and ide_add_generic_settings()
* make ide_find_setting_by_name(), ide_{read,write}_setting()
and ide_{add,remove}_proc_entries() static
* cover IDE settings code in device drivers with CONFIG_IDE_PROC_FS #ifdef,
also while at it cover with CONFIG_IDE_PROC_FS #ifdef ide_driver_t.proc
* remove bogus comment from ide.h
* cover with CONFIG_IDE_PROC_FS #ifdef .proc and .settings in ide_drive_t
Besides saner code this patch results in the IDE core smaller by ~2 kB
(on x86-32) and IDE disk driver by ~1 kB (ditto) when CONFIG_IDE_PROC_FS=n.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 4388b8ab69a1..8263f752809d 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -721,6 +721,7 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
721 | return ide_stopped; | 721 | return ide_stopped; |
722 | } | 722 | } |
723 | 723 | ||
724 | #ifdef CONFIG_IDE_PROC_FS | ||
724 | static void idescsi_add_settings(ide_drive_t *drive) | 725 | static void idescsi_add_settings(ide_drive_t *drive) |
725 | { | 726 | { |
726 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 727 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
@@ -734,6 +735,9 @@ static void idescsi_add_settings(ide_drive_t *drive) | |||
734 | ide_add_setting(drive, "transform", SETTING_RW, TYPE_INT, 0, 3, 1, 1, &scsi->transform, NULL); | 735 | ide_add_setting(drive, "transform", SETTING_RW, TYPE_INT, 0, 3, 1, 1, &scsi->transform, NULL); |
735 | ide_add_setting(drive, "log", SETTING_RW, TYPE_INT, 0, 1, 1, 1, &scsi->log, NULL); | 736 | ide_add_setting(drive, "log", SETTING_RW, TYPE_INT, 0, 1, 1, 1, &scsi->log, NULL); |
736 | } | 737 | } |
738 | #else | ||
739 | static inline void idescsi_add_settings(ide_drive_t *drive) { ; } | ||
740 | #endif | ||
737 | 741 | ||
738 | /* | 742 | /* |
739 | * Driver initialization. | 743 | * Driver initialization. |
@@ -756,7 +760,7 @@ static void ide_scsi_remove(ide_drive_t *drive) | |||
756 | struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost); | 760 | struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost); |
757 | struct gendisk *g = scsi->disk; | 761 | struct gendisk *g = scsi->disk; |
758 | 762 | ||
759 | ide_unregister_subdriver(drive, scsi->driver); | 763 | ide_proc_unregister_driver(drive, scsi->driver); |
760 | 764 | ||
761 | ide_unregister_region(g); | 765 | ide_unregister_region(g); |
762 | 766 | ||
@@ -775,8 +779,6 @@ static ide_proc_entry_t idescsi_proc[] = { | |||
775 | { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, | 779 | { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, |
776 | { NULL, 0, NULL, NULL } | 780 | { NULL, 0, NULL, NULL } |
777 | }; | 781 | }; |
778 | #else | ||
779 | # define idescsi_proc NULL | ||
780 | #endif | 782 | #endif |
781 | 783 | ||
782 | static ide_driver_t idescsi_driver = { | 784 | static ide_driver_t idescsi_driver = { |
@@ -790,11 +792,13 @@ static ide_driver_t idescsi_driver = { | |||
790 | .version = IDESCSI_VERSION, | 792 | .version = IDESCSI_VERSION, |
791 | .media = ide_scsi, | 793 | .media = ide_scsi, |
792 | .supports_dsc_overlap = 0, | 794 | .supports_dsc_overlap = 0, |
793 | .proc = idescsi_proc, | ||
794 | .do_request = idescsi_do_request, | 795 | .do_request = idescsi_do_request, |
795 | .end_request = idescsi_end_request, | 796 | .end_request = idescsi_end_request, |
796 | .error = idescsi_atapi_error, | 797 | .error = idescsi_atapi_error, |
797 | .abort = idescsi_atapi_abort, | 798 | .abort = idescsi_atapi_abort, |
799 | #ifdef CONFIG_IDE_PROC_FS | ||
800 | .proc = idescsi_proc, | ||
801 | #endif | ||
798 | }; | 802 | }; |
799 | 803 | ||
800 | static int idescsi_ide_open(struct inode *inode, struct file *filp) | 804 | static int idescsi_ide_open(struct inode *inode, struct file *filp) |
@@ -1153,7 +1157,7 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
1153 | idescsi->host = host; | 1157 | idescsi->host = host; |
1154 | idescsi->disk = g; | 1158 | idescsi->disk = g; |
1155 | g->private_data = &idescsi->driver; | 1159 | g->private_data = &idescsi->driver; |
1156 | ide_register_subdriver(drive, &idescsi_driver); | 1160 | ide_proc_register_driver(drive, &idescsi_driver); |
1157 | err = 0; | 1161 | err = 0; |
1158 | idescsi_setup(drive, idescsi); | 1162 | idescsi_setup(drive, idescsi); |
1159 | g->fops = &idescsi_ops; | 1163 | g->fops = &idescsi_ops; |
@@ -1165,7 +1169,7 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
1165 | } | 1169 | } |
1166 | /* fall through on error */ | 1170 | /* fall through on error */ |
1167 | ide_unregister_region(g); | 1171 | ide_unregister_region(g); |
1168 | ide_unregister_subdriver(drive, &idescsi_driver); | 1172 | ide_proc_unregister_driver(drive, &idescsi_driver); |
1169 | 1173 | ||
1170 | put_disk(g); | 1174 | put_disk(g); |
1171 | out_host_put: | 1175 | out_host_put: |