aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2008-04-26 16:25:15 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:15 -0400
commit5e657a9e29baa0d8f5c0cf99372100d397340f00 (patch)
treebdbb380ab7f7ec65416fc4b43dd55b25d34b9cb1 /drivers/ide
parent9aba468e4ae834dd0ee37004e5d07309684e14d2 (diff)
ide-cd: put all proc-related code at one place
Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0ffa318c53d9..90714494c796 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1695,15 +1695,6 @@ int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1695 return nslots; 1695 return nslots;
1696} 1696}
1697 1697
1698#ifdef CONFIG_IDE_PROC_FS
1699static void ide_cdrom_add_settings(ide_drive_t *drive)
1700{
1701 ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL);
1702}
1703#else
1704static inline void ide_cdrom_add_settings(ide_drive_t *drive) { ; }
1705#endif
1706
1707/* 1698/*
1708 * standard prep_rq_fn that builds 10 byte cmds 1699 * standard prep_rq_fn that builds 10 byte cmds
1709 */ 1700 */
@@ -1789,6 +1780,41 @@ struct cd_list_entry {
1789 unsigned int cd_flags; 1780 unsigned int cd_flags;
1790}; 1781};
1791 1782
1783#ifdef CONFIG_IDE_PROC_FS
1784static sector_t ide_cdrom_capacity(ide_drive_t *drive)
1785{
1786 unsigned long capacity, sectors_per_frame;
1787
1788 if (cdrom_read_capacity(drive, &capacity, &sectors_per_frame, NULL))
1789 return 0;
1790
1791 return capacity * sectors_per_frame;
1792}
1793
1794static int proc_idecd_read_capacity
1795 (char *page, char **start, off_t off, int count, int *eof, void *data)
1796{
1797 ide_drive_t *drive = data;
1798 int len;
1799
1800 len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive));
1801 PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
1802}
1803
1804static ide_proc_entry_t idecd_proc[] = {
1805 { "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL },
1806 { NULL, 0, NULL, NULL }
1807};
1808
1809static void ide_cdrom_add_settings(ide_drive_t *drive)
1810{
1811 ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
1812 &drive->dsc_overlap, NULL);
1813}
1814#else
1815static inline void ide_cdrom_add_settings(ide_drive_t *drive) { ; }
1816#endif
1817
1792static const struct cd_list_entry ide_cd_quirks_list[] = { 1818static const struct cd_list_entry ide_cd_quirks_list[] = {
1793 /* Limit transfer size per interrupt. */ 1819 /* Limit transfer size per interrupt. */
1794 { "SAMSUNG CD-ROM SCR-2430", NULL, IDE_CD_FLAG_LIMIT_NFRAMES }, 1820 { "SAMSUNG CD-ROM SCR-2430", NULL, IDE_CD_FLAG_LIMIT_NFRAMES },
@@ -1929,33 +1955,6 @@ static void ide_cd_release(struct kref *kref)
1929 1955
1930static int ide_cd_probe(ide_drive_t *); 1956static int ide_cd_probe(ide_drive_t *);
1931 1957
1932#ifdef CONFIG_IDE_PROC_FS
1933static sector_t ide_cdrom_capacity(ide_drive_t *drive)
1934{
1935 unsigned long capacity, sectors_per_frame;
1936
1937 if (cdrom_read_capacity(drive, &capacity, &sectors_per_frame, NULL))
1938 return 0;
1939
1940 return capacity * sectors_per_frame;
1941}
1942
1943static int proc_idecd_read_capacity
1944 (char *page, char **start, off_t off, int count, int *eof, void *data)
1945{
1946 ide_drive_t *drive = data;
1947 int len;
1948
1949 len = sprintf(page, "%llu\n", (long long)ide_cdrom_capacity(drive));
1950 PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
1951}
1952
1953static ide_proc_entry_t idecd_proc[] = {
1954 { "capacity", S_IFREG|S_IRUGO, proc_idecd_read_capacity, NULL },
1955 { NULL, 0, NULL, NULL }
1956};
1957#endif
1958
1959static ide_driver_t ide_cdrom_driver = { 1958static ide_driver_t ide_cdrom_driver = {
1960 .gen_driver = { 1959 .gen_driver = {
1961 .owner = THIS_MODULE, 1960 .owner = THIS_MODULE,