aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:21 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:21 -0500
commit0ba11211f9ac583333aac44daec5af4f7eeba217 (patch)
tree517ca173a21e0a84c3703f3a3ba8d56ba071f801 /drivers/ide
parent4fe6717862d4977b8e61307a2623ed7739068bdc (diff)
ide-cd: kill CDROM_STATE_FLAGS() macro
While at it rename 'info' variable to 'cd' in cdrom_saw_media_change(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c44
-rw-r--r--drivers/ide/ide-cd.h2
2 files changed, 24 insertions, 22 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3e1923d0bec1..59981a043182 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -93,11 +93,11 @@ static void ide_cd_put(struct cdrom_info *cd)
93 buffers. */ 93 buffers. */
94static void cdrom_saw_media_change (ide_drive_t *drive) 94static void cdrom_saw_media_change (ide_drive_t *drive)
95{ 95{
96 struct cdrom_info *info = drive->driver_data; 96 struct cdrom_info *cd = drive->driver_data;
97 97
98 CDROM_STATE_FLAGS (drive)->media_changed = 1; 98 cd->state_flags.media_changed = 1;
99 CDROM_STATE_FLAGS (drive)->toc_valid = 0; 99 cd->state_flags.toc_valid = 0;
100 info->nsectors_buffered = 0; 100 cd->nsectors_buffered = 0;
101} 101}
102 102
103static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, 103static int cdrom_log_sense(ide_drive_t *drive, struct request *rq,
@@ -1880,7 +1880,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense)
1880 stat = 0; 1880 stat = 0;
1881 1881
1882 if (stat == 0) 1882 if (stat == 0)
1883 CDROM_STATE_FLAGS(drive)->door_locked = lockflag; 1883 cd->state_flags.door_locked = lockflag;
1884 1884
1885 return stat; 1885 return stat;
1886} 1886}
@@ -1900,7 +1900,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
1900 return -EDRIVE_CANT_DO_THIS; 1900 return -EDRIVE_CANT_DO_THIS;
1901 1901
1902 /* reload fails on some drives, if the tray is locked */ 1902 /* reload fails on some drives, if the tray is locked */
1903 if (CDROM_STATE_FLAGS(drive)->door_locked && ejectflag) 1903 if (cd->state_flags.door_locked && ejectflag)
1904 return 0; 1904 return 0;
1905 1905
1906 cdrom_prepare_request(drive, &req); 1906 cdrom_prepare_request(drive, &req);
@@ -1998,7 +1998,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
1998 If it is, just return. */ 1998 If it is, just return. */
1999 (void) cdrom_check_status(drive, sense); 1999 (void) cdrom_check_status(drive, sense);
2000 2000
2001 if (CDROM_STATE_FLAGS(drive)->toc_valid) 2001 if (info->state_flags.toc_valid)
2002 return 0; 2002 return 0;
2003 2003
2004 /* Try to get the total cdrom capacity and sector size. */ 2004 /* Try to get the total cdrom capacity and sector size. */
@@ -2137,7 +2137,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2137 } 2137 }
2138 2138
2139 /* Remember that we've read this stuff. */ 2139 /* Remember that we've read this stuff. */
2140 CDROM_STATE_FLAGS(drive)->toc_valid = 1; 2140 info->state_flags.toc_valid = 1;
2141 2141
2142 return 0; 2142 return 0;
2143} 2143}
@@ -2219,7 +2219,7 @@ static int cdrom_get_toc_entry(ide_drive_t *drive, int track,
2219 /* 2219 /*
2220 * don't serve cached data, if the toc isn't valid 2220 * don't serve cached data, if the toc isn't valid
2221 */ 2221 */
2222 if (!CDROM_STATE_FLAGS(drive)->toc_valid) 2222 if (!info->state_flags.toc_valid)
2223 return -EINVAL; 2223 return -EINVAL;
2224 2224
2225 /* Check validity of requested track number. */ 2225 /* Check validity of requested track number. */
@@ -2351,6 +2351,7 @@ static
2351int ide_cdrom_reset (struct cdrom_device_info *cdi) 2351int ide_cdrom_reset (struct cdrom_device_info *cdi)
2352{ 2352{
2353 ide_drive_t *drive = cdi->handle; 2353 ide_drive_t *drive = cdi->handle;
2354 struct cdrom_info *cd = drive->driver_data;
2354 struct request_sense sense; 2355 struct request_sense sense;
2355 struct request req; 2356 struct request req;
2356 int ret; 2357 int ret;
@@ -2364,7 +2365,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
2364 * A reset will unlock the door. If it was previously locked, 2365 * A reset will unlock the door. If it was previously locked,
2365 * lock it again. 2366 * lock it again.
2366 */ 2367 */
2367 if (CDROM_STATE_FLAGS(drive)->door_locked) 2368 if (cd->state_flags.door_locked)
2368 (void) cdrom_lockdoor(drive, 1, &sense); 2369 (void) cdrom_lockdoor(drive, 1, &sense);
2369 2370
2370 return ret; 2371 return ret;
@@ -2434,7 +2435,7 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
2434 maxspeed = be16_to_cpu(cap->maxspeed); 2435 maxspeed = be16_to_cpu(cap->maxspeed);
2435 } 2436 }
2436 2437
2437 CDROM_STATE_FLAGS(drive)->current_speed = (curspeed + (176/2)) / 176; 2438 cd->state_flags.current_speed = (curspeed + (176/2)) / 176;
2438 cd->config_flags.max_speed = (maxspeed + (176/2)) / 176; 2439 cd->config_flags.max_speed = (maxspeed + (176/2)) / 176;
2439} 2440}
2440 2441
@@ -2442,6 +2443,7 @@ static
2442int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed) 2443int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
2443{ 2444{
2444 ide_drive_t *drive = cdi->handle; 2445 ide_drive_t *drive = cdi->handle;
2446 struct cdrom_info *cd = drive->driver_data;
2445 struct request_sense sense; 2447 struct request_sense sense;
2446 struct atapi_capabilities_page cap; 2448 struct atapi_capabilities_page cap;
2447 int stat; 2449 int stat;
@@ -2451,7 +2453,7 @@ int ide_cdrom_select_speed (struct cdrom_device_info *cdi, int speed)
2451 2453
2452 if (!ide_cdrom_get_capabilities(drive, &cap)) { 2454 if (!ide_cdrom_get_capabilities(drive, &cap)) {
2453 ide_cdrom_update_speed(drive, &cap); 2455 ide_cdrom_update_speed(drive, &cap);
2454 cdi->speed = CDROM_STATE_FLAGS(drive)->current_speed; 2456 cdi->speed = cd->state_flags.current_speed;
2455 } 2457 }
2456 return 0; 2458 return 0;
2457} 2459}
@@ -2512,7 +2514,7 @@ int ide_cdrom_get_last_session (struct cdrom_device_info *cdi,
2512 struct request_sense sense; 2514 struct request_sense sense;
2513 int ret; 2515 int ret;
2514 2516
2515 if (!CDROM_STATE_FLAGS(drive)->toc_valid || info->toc == NULL) 2517 if (!info->state_flags.toc_valid || info->toc == NULL)
2516 if ((ret = cdrom_read_toc(drive, &sense))) 2518 if ((ret = cdrom_read_toc(drive, &sense)))
2517 return ret; 2519 return ret;
2518 2520
@@ -2554,12 +2556,13 @@ int ide_cdrom_check_media_change_real (struct cdrom_device_info *cdi,
2554 int slot_nr) 2556 int slot_nr)
2555{ 2557{
2556 ide_drive_t *drive = cdi->handle; 2558 ide_drive_t *drive = cdi->handle;
2559 struct cdrom_info *cd = drive->driver_data;
2557 int retval; 2560 int retval;
2558 2561
2559 if (slot_nr == CDSL_CURRENT) { 2562 if (slot_nr == CDSL_CURRENT) {
2560 (void) cdrom_check_status(drive, NULL); 2563 (void) cdrom_check_status(drive, NULL);
2561 retval = CDROM_STATE_FLAGS(drive)->media_changed; 2564 retval = cd->state_flags.media_changed;
2562 CDROM_STATE_FLAGS(drive)->media_changed = 0; 2565 cd->state_flags.media_changed = 0;
2563 return retval; 2566 return retval;
2564 } else { 2567 } else {
2565 return -EINVAL; 2568 return -EINVAL;
@@ -2581,9 +2584,10 @@ static
2581void ide_cdrom_release_real (struct cdrom_device_info *cdi) 2584void ide_cdrom_release_real (struct cdrom_device_info *cdi)
2582{ 2585{
2583 ide_drive_t *drive = cdi->handle; 2586 ide_drive_t *drive = cdi->handle;
2587 struct cdrom_info *cd = drive->driver_data;
2584 2588
2585 if (!cdi->use_count) 2589 if (!cdi->use_count)
2586 CDROM_STATE_FLAGS(drive)->toc_valid = 0; 2590 cd->state_flags.toc_valid = 0;
2587} 2591}
2588 2592
2589#define IDE_CD_CAPABILITIES \ 2593#define IDE_CD_CAPABILITIES \
@@ -2615,7 +2619,7 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2615 struct cdrom_device_info *devinfo = &info->devinfo; 2619 struct cdrom_device_info *devinfo = &info->devinfo;
2616 2620
2617 devinfo->ops = &ide_cdrom_dops; 2621 devinfo->ops = &ide_cdrom_dops;
2618 devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed; 2622 devinfo->speed = info->state_flags.current_speed;
2619 devinfo->capacity = nslots; 2623 devinfo->capacity = nslots;
2620 devinfo->handle = drive; 2624 devinfo->handle = drive;
2621 strcpy(devinfo->name, drive->name); 2625 strcpy(devinfo->name, drive->name);
@@ -2841,7 +2845,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
2841 2845
2842 drive->special.all = 0; 2846 drive->special.all = 0;
2843 2847
2844 CDROM_STATE_FLAGS(drive)->media_changed = 1; 2848 cd->state_flags.media_changed = 1;
2845 2849
2846#if NO_DOOR_LOCKING 2850#if NO_DOOR_LOCKING
2847 cd->config_flags.no_doorlock = 1; 2851 cd->config_flags.no_doorlock = 1;
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 9e1cee69c0fc..8dbe346b4b44 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -80,8 +80,6 @@ struct ide_cd_state_flags {
80 byte current_speed; /* Current speed of the drive */ 80 byte current_speed; /* Current speed of the drive */
81}; 81};
82 82
83#define CDROM_STATE_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->state_flags))
84
85/* Structure of a MSF cdrom address. */ 83/* Structure of a MSF cdrom address. */
86struct atapi_msf { 84struct atapi_msf {
87 byte reserved; 85 byte reserved;