diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:20 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:20 -0500 |
commit | 3f1b86d89dc73dedda426a85e600ad244ed9fad4 (patch) | |
tree | c5003d45ed9569b022228b466385883d9c5d0b4e /drivers | |
parent | 20e7f7efa3da3678c65cea45903260dfabb8264c (diff) |
ide-cd: remove redundant config flags
* Use CDC_* flags directly and remove redundant flags from ->config_flags.
While at it:
* Add KERN_CONT to printk()-s in ide_cdrom_probe_capabilities().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-cd.c | 98 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 10 |
2 files changed, 38 insertions, 70 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d8c2ce1f9854..81247a0587e6 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1889,6 +1889,8 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense) | |||
1889 | static int cdrom_eject(ide_drive_t *drive, int ejectflag, | 1889 | static int cdrom_eject(ide_drive_t *drive, int ejectflag, |
1890 | struct request_sense *sense) | 1890 | struct request_sense *sense) |
1891 | { | 1891 | { |
1892 | struct cdrom_info *cd = drive->driver_data; | ||
1893 | struct cdrom_device_info *cdi = &cd->devinfo; | ||
1892 | struct request req; | 1894 | struct request req; |
1893 | char loej = 0x02; | 1895 | char loej = 0x02; |
1894 | 1896 | ||
@@ -1902,7 +1904,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag, | |||
1902 | cdrom_prepare_request(drive, &req); | 1904 | cdrom_prepare_request(drive, &req); |
1903 | 1905 | ||
1904 | /* only tell drive to close tray if open, if it can do that */ | 1906 | /* only tell drive to close tray if open, if it can do that */ |
1905 | if (ejectflag && !CDROM_CONFIG_FLAGS(drive)->close_tray) | 1907 | if (ejectflag && (cdi->mask & CDC_CLOSE_TRAY)) |
1906 | loej = 0; | 1908 | loej = 0; |
1907 | 1909 | ||
1908 | req.sense = sense; | 1910 | req.sense = sense; |
@@ -2163,6 +2165,8 @@ static int cdrom_read_subchannel(ide_drive_t *drive, int format, char *buf, | |||
2163 | static int cdrom_select_speed(ide_drive_t *drive, int speed, | 2165 | static int cdrom_select_speed(ide_drive_t *drive, int speed, |
2164 | struct request_sense *sense) | 2166 | struct request_sense *sense) |
2165 | { | 2167 | { |
2168 | struct cdrom_info *cd = drive->driver_data; | ||
2169 | struct cdrom_device_info *cdi = &cd->devinfo; | ||
2166 | struct request req; | 2170 | struct request req; |
2167 | cdrom_prepare_request(drive, &req); | 2171 | cdrom_prepare_request(drive, &req); |
2168 | 2172 | ||
@@ -2177,9 +2181,8 @@ static int cdrom_select_speed(ide_drive_t *drive, int speed, | |||
2177 | req.cmd[2] = (speed >> 8) & 0xff; | 2181 | req.cmd[2] = (speed >> 8) & 0xff; |
2178 | /* Read Drive speed in kbytes/second LSB */ | 2182 | /* Read Drive speed in kbytes/second LSB */ |
2179 | req.cmd[3] = speed & 0xff; | 2183 | req.cmd[3] = speed & 0xff; |
2180 | if (CDROM_CONFIG_FLAGS(drive)->cd_r || | 2184 | if ((cdi->mask & (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) != |
2181 | CDROM_CONFIG_FLAGS(drive)->cd_rw || | 2185 | (CDC_CD_R | CDC_CD_RW | CDC_DVD_R)) { |
2182 | CDROM_CONFIG_FLAGS(drive)->dvd_r) { | ||
2183 | /* Write Drive speed in kbytes/second MSB */ | 2186 | /* Write Drive speed in kbytes/second MSB */ |
2184 | req.cmd[4] = (speed >> 8) & 0xff; | 2187 | req.cmd[4] = (speed >> 8) & 0xff; |
2185 | /* Write Drive speed in kbytes/second LSB */ | 2188 | /* Write Drive speed in kbytes/second LSB */ |
@@ -2609,33 +2612,10 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) | |||
2609 | struct cdrom_device_info *devinfo = &info->devinfo; | 2612 | struct cdrom_device_info *devinfo = &info->devinfo; |
2610 | 2613 | ||
2611 | devinfo->ops = &ide_cdrom_dops; | 2614 | devinfo->ops = &ide_cdrom_dops; |
2612 | devinfo->mask = 0; | ||
2613 | devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed; | 2615 | devinfo->speed = CDROM_STATE_FLAGS(drive)->current_speed; |
2614 | devinfo->capacity = nslots; | 2616 | devinfo->capacity = nslots; |
2615 | devinfo->handle = drive; | 2617 | devinfo->handle = drive; |
2616 | strcpy(devinfo->name, drive->name); | 2618 | strcpy(devinfo->name, drive->name); |
2617 | |||
2618 | /* set capability mask to match the probe. */ | ||
2619 | if (!CDROM_CONFIG_FLAGS(drive)->cd_r) | ||
2620 | devinfo->mask |= CDC_CD_R; | ||
2621 | if (!CDROM_CONFIG_FLAGS(drive)->cd_rw) | ||
2622 | devinfo->mask |= CDC_CD_RW; | ||
2623 | if (!CDROM_CONFIG_FLAGS(drive)->dvd) | ||
2624 | devinfo->mask |= CDC_DVD; | ||
2625 | if (!CDROM_CONFIG_FLAGS(drive)->dvd_r) | ||
2626 | devinfo->mask |= CDC_DVD_R; | ||
2627 | if (!CDROM_CONFIG_FLAGS(drive)->dvd_ram) | ||
2628 | devinfo->mask |= CDC_DVD_RAM; | ||
2629 | if (!CDROM_CONFIG_FLAGS(drive)->is_changer) | ||
2630 | devinfo->mask |= CDC_SELECT_DISC; | ||
2631 | if (!CDROM_CONFIG_FLAGS(drive)->audio_play) | ||
2632 | devinfo->mask |= CDC_PLAY_AUDIO; | ||
2633 | if (!CDROM_CONFIG_FLAGS(drive)->close_tray) | ||
2634 | devinfo->mask |= CDC_CLOSE_TRAY; | ||
2635 | if (!CDROM_CONFIG_FLAGS(drive)->mo_drive) | ||
2636 | devinfo->mask |= CDC_MO_DRIVE; | ||
2637 | if (!CDROM_CONFIG_FLAGS(drive)->ram) | ||
2638 | devinfo->mask |= CDC_RAM; | ||
2639 | 2619 | ||
2640 | if (CDROM_CONFIG_FLAGS(drive)->no_speed_select) | 2620 | if (CDROM_CONFIG_FLAGS(drive)->no_speed_select) |
2641 | devinfo->mask |= CDC_SELECT_SPEED; | 2621 | devinfo->mask |= CDC_SELECT_SPEED; |
@@ -2652,9 +2632,12 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2652 | struct atapi_capabilities_page cap; | 2632 | struct atapi_capabilities_page cap; |
2653 | int nslots = 1; | 2633 | int nslots = 1; |
2654 | 2634 | ||
2635 | cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | | ||
2636 | CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO | | ||
2637 | CDC_MO_DRIVE | CDC_RAM); | ||
2638 | |||
2655 | if (drive->media == ide_optical) { | 2639 | if (drive->media == ide_optical) { |
2656 | CDROM_CONFIG_FLAGS(drive)->mo_drive = 1; | 2640 | cdi->mask &= ~(CDC_MO_DRIVE | CDC_RAM); |
2657 | CDROM_CONFIG_FLAGS(drive)->ram = 1; | ||
2658 | printk(KERN_ERR "%s: ATAPI magneto-optical drive\n", drive->name); | 2641 | printk(KERN_ERR "%s: ATAPI magneto-optical drive\n", drive->name); |
2659 | return nslots; | 2642 | return nslots; |
2660 | } | 2643 | } |
@@ -2662,7 +2645,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2662 | if (CDROM_CONFIG_FLAGS(drive)->nec260 || | 2645 | if (CDROM_CONFIG_FLAGS(drive)->nec260 || |
2663 | !strcmp(drive->id->model,"STINGRAY 8422 IDE 8X CD-ROM 7-27-95")) { | 2646 | !strcmp(drive->id->model,"STINGRAY 8422 IDE 8X CD-ROM 7-27-95")) { |
2664 | CDROM_CONFIG_FLAGS(drive)->no_eject = 0; | 2647 | CDROM_CONFIG_FLAGS(drive)->no_eject = 0; |
2665 | CDROM_CONFIG_FLAGS(drive)->audio_play = 1; | 2648 | cdi->mask &= ~CDC_PLAY_AUDIO; |
2666 | return nslots; | 2649 | return nslots; |
2667 | } | 2650 | } |
2668 | 2651 | ||
@@ -2684,23 +2667,19 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2684 | if (cap.eject) | 2667 | if (cap.eject) |
2685 | CDROM_CONFIG_FLAGS(drive)->no_eject = 0; | 2668 | CDROM_CONFIG_FLAGS(drive)->no_eject = 0; |
2686 | if (cap.cd_r_write) | 2669 | if (cap.cd_r_write) |
2687 | CDROM_CONFIG_FLAGS(drive)->cd_r = 1; | 2670 | cdi->mask &= ~CDC_CD_R; |
2688 | if (cap.cd_rw_write) { | 2671 | if (cap.cd_rw_write) |
2689 | CDROM_CONFIG_FLAGS(drive)->cd_rw = 1; | 2672 | cdi->mask &= ~(CDC_CD_RW | CDC_RAM); |
2690 | CDROM_CONFIG_FLAGS(drive)->ram = 1; | ||
2691 | } | ||
2692 | if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom) | 2673 | if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom) |
2693 | CDROM_CONFIG_FLAGS(drive)->dvd = 1; | 2674 | cdi->mask &= ~CDC_DVD; |
2694 | if (cap.dvd_ram_write) { | 2675 | if (cap.dvd_ram_write) |
2695 | CDROM_CONFIG_FLAGS(drive)->dvd_ram = 1; | 2676 | cdi->mask &= ~(CDC_DVD_RAM | CDC_RAM); |
2696 | CDROM_CONFIG_FLAGS(drive)->ram = 1; | ||
2697 | } | ||
2698 | if (cap.dvd_r_write) | 2677 | if (cap.dvd_r_write) |
2699 | CDROM_CONFIG_FLAGS(drive)->dvd_r = 1; | 2678 | cdi->mask &= ~CDC_DVD_R; |
2700 | if (cap.audio_play) | 2679 | if (cap.audio_play) |
2701 | CDROM_CONFIG_FLAGS(drive)->audio_play = 1; | 2680 | cdi->mask &= ~CDC_PLAY_AUDIO; |
2702 | if (cap.mechtype == mechtype_caddy || cap.mechtype == mechtype_popup) | 2681 | if (cap.mechtype == mechtype_caddy || cap.mechtype == mechtype_popup) |
2703 | CDROM_CONFIG_FLAGS(drive)->close_tray = 0; | 2682 | cdi->mask |= CDC_CLOSE_TRAY; |
2704 | 2683 | ||
2705 | /* Some drives used by Apple don't advertise audio play | 2684 | /* Some drives used by Apple don't advertise audio play |
2706 | * but they do support reading TOC & audio datas | 2685 | * but they do support reading TOC & audio datas |
@@ -2709,11 +2688,11 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2709 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8186") == 0 || | 2688 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8186") == 0 || |
2710 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8176") == 0 || | 2689 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8176") == 0 || |
2711 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8174") == 0) | 2690 | strcmp(drive->id->model, "MATSHITADVD-ROM SR-8174") == 0) |
2712 | CDROM_CONFIG_FLAGS(drive)->audio_play = 1; | 2691 | cdi->mask &= ~CDC_PLAY_AUDIO; |
2713 | 2692 | ||
2714 | #if ! STANDARD_ATAPI | 2693 | #if ! STANDARD_ATAPI |
2715 | if (cdi->sanyo_slot > 0) { | 2694 | if (cdi->sanyo_slot > 0) { |
2716 | CDROM_CONFIG_FLAGS(drive)->is_changer = 1; | 2695 | cdi->mask &= ~CDC_SELECT_DISC; |
2717 | nslots = 3; | 2696 | nslots = 3; |
2718 | } | 2697 | } |
2719 | 2698 | ||
@@ -2723,7 +2702,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2723 | cap.mechtype == mechtype_cartridge_changer) { | 2702 | cap.mechtype == mechtype_cartridge_changer) { |
2724 | nslots = cdrom_number_of_slots(cdi); | 2703 | nslots = cdrom_number_of_slots(cdi); |
2725 | if (nslots > 1) | 2704 | if (nslots > 1) |
2726 | CDROM_CONFIG_FLAGS(drive)->is_changer = 1; | 2705 | cdi->mask &= ~CDC_SELECT_DISC; |
2727 | } | 2706 | } |
2728 | 2707 | ||
2729 | ide_cdrom_update_speed(drive, &cap); | 2708 | ide_cdrom_update_speed(drive, &cap); |
@@ -2732,22 +2711,22 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) | |||
2732 | printk(KERN_INFO "%s: ATAPI", drive->name); | 2711 | printk(KERN_INFO "%s: ATAPI", drive->name); |
2733 | if (CDROM_CONFIG_FLAGS(drive)->max_speed) | 2712 | if (CDROM_CONFIG_FLAGS(drive)->max_speed) |
2734 | printk(" %dX", CDROM_CONFIG_FLAGS(drive)->max_speed); | 2713 | printk(" %dX", CDROM_CONFIG_FLAGS(drive)->max_speed); |
2735 | printk(" %s", CDROM_CONFIG_FLAGS(drive)->dvd ? "DVD-ROM" : "CD-ROM"); | 2714 | printk(KERN_CONT " %s", (cdi->mask & CDC_DVD) ? "CD-ROM" : "DVD-ROM"); |
2736 | 2715 | ||
2737 | if (CDROM_CONFIG_FLAGS(drive)->dvd_r|CDROM_CONFIG_FLAGS(drive)->dvd_ram) | 2716 | if ((cdi->mask & CDC_DVD_R) == 0 || (cdi->mask & CDC_DVD_RAM) == 0) |
2738 | printk(" DVD%s%s", | 2717 | printk(KERN_CONT " DVD%s%s", |
2739 | (CDROM_CONFIG_FLAGS(drive)->dvd_r)? "-R" : "", | 2718 | (cdi->mask & CDC_DVD_R) ? "" : "-R", |
2740 | (CDROM_CONFIG_FLAGS(drive)->dvd_ram)? "-RAM" : ""); | 2719 | (cdi->mask & CDC_DVD_RAM) ? "" : "-RAM"); |
2741 | 2720 | ||
2742 | if (CDROM_CONFIG_FLAGS(drive)->cd_r|CDROM_CONFIG_FLAGS(drive)->cd_rw) | 2721 | if ((cdi->mask & CDC_CD_R) == 0 || (cdi->mask & CDC_CD_RW) == 0) |
2743 | printk(" CD%s%s", | 2722 | printk(KERN_CONT " CD%s%s", |
2744 | (CDROM_CONFIG_FLAGS(drive)->cd_r)? "-R" : "", | 2723 | (cdi->mask & CDC_CD_R) ? "" : "-R", |
2745 | (CDROM_CONFIG_FLAGS(drive)->cd_rw)? "/RW" : ""); | 2724 | (cdi->mask & CDC_CD_RW) ? "" : "/RW"); |
2746 | 2725 | ||
2747 | if (CDROM_CONFIG_FLAGS(drive)->is_changer) | 2726 | if ((cdi->mask & CDC_SELECT_DISC) == 0) |
2748 | printk(" changer w/%d slots", nslots); | 2727 | printk(KERN_CONT " changer w/%d slots", nslots); |
2749 | else | 2728 | else |
2750 | printk(" drive"); | 2729 | printk(KERN_CONT " drive"); |
2751 | 2730 | ||
2752 | printk(KERN_CONT ", %dkB Cache\n", be16_to_cpu(cap.buffer_size)); | 2731 | printk(KERN_CONT ", %dkB Cache\n", be16_to_cpu(cap.buffer_size)); |
2753 | 2732 | ||
@@ -2865,7 +2844,6 @@ int ide_cdrom_setup (ide_drive_t *drive) | |||
2865 | if ((drive->id->config & 0x0060) == 0x20) | 2844 | if ((drive->id->config & 0x0060) == 0x20) |
2866 | CDROM_CONFIG_FLAGS(drive)->drq_interrupt = 1; | 2845 | CDROM_CONFIG_FLAGS(drive)->drq_interrupt = 1; |
2867 | CDROM_CONFIG_FLAGS(drive)->no_eject = 1; | 2846 | CDROM_CONFIG_FLAGS(drive)->no_eject = 1; |
2868 | CDROM_CONFIG_FLAGS(drive)->close_tray = 1; | ||
2869 | 2847 | ||
2870 | /* limit transfer size per interrupt. */ | 2848 | /* limit transfer size per interrupt. */ |
2871 | /* a testament to the nice quality of Samsung drives... */ | 2849 | /* a testament to the nice quality of Samsung drives... */ |
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 5bda4ec9ad2d..b989c9835174 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -61,20 +61,10 @@ struct ide_cd_config_flags { | |||
61 | __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ | 61 | __u8 nec260 : 1; /* Drive is a pre-1.2 NEC 260 drive. */ |
62 | __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ | 62 | __u8 tocaddr_as_bcd : 1; /* TOC addresses are in BCD. */ |
63 | __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ | 63 | __u8 toctracks_as_bcd : 1; /* TOC track numbers are in BCD. */ |
64 | __u8 is_changer : 1; /* Drive is a changer. */ | ||
65 | __u8 cd_r : 1; /* Drive can write to CD-R media . */ | ||
66 | __u8 cd_rw : 1; /* Drive can write to CD-R/W media . */ | ||
67 | __u8 dvd : 1; /* Drive is a DVD-ROM */ | ||
68 | __u8 dvd_r : 1; /* Drive can write DVD-R */ | ||
69 | __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ | ||
70 | __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ | ||
71 | __u8 limit_nframes : 1; /* Drive does not provide data in | 64 | __u8 limit_nframes : 1; /* Drive does not provide data in |
72 | multiples of SECTOR_SIZE when more | 65 | multiples of SECTOR_SIZE when more |
73 | than one interrupt is needed. */ | 66 | than one interrupt is needed. */ |
74 | __u8 seeking : 1; /* Seeking in progress */ | 67 | __u8 seeking : 1; /* Seeking in progress */ |
75 | __u8 audio_play : 1; /* can do audio related commands */ | ||
76 | __u8 close_tray : 1; /* can close the tray */ | ||
77 | __u8 mo_drive : 1; /* drive is an MO device */ | ||
78 | __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */ | 68 | __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */ |
79 | byte max_speed; /* Max speed of the drive */ | 69 | byte max_speed; /* Max speed of the drive */ |
80 | }; | 70 | }; |