Skip to content

Commit f5bdc61

Browse files
hutharndb
authored andcommitted
pktcdvd: Remove CONFIG_CDROM_PKTCDVD_WCACHE from uapi header
CONFIG_* switches should not be exposed in uapi headers, thus let's get rid of the USE_WCACHING macro here (which was also named way to generic) and integrate the logic directly in the only function that needs it. Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Thomas Huth <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent d3c7ec7 commit f5bdc61

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

drivers/block/pktcdvd.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,12 +1869,12 @@ static noinline_for_stack int pkt_probe_settings(struct pktcdvd_device *pd)
18691869
/*
18701870
* enable/disable write caching on drive
18711871
*/
1872-
static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
1873-
int set)
1872+
static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd)
18741873
{
18751874
struct packet_command cgc;
18761875
struct scsi_sense_hdr sshdr;
18771876
unsigned char buf[64];
1877+
bool set = IS_ENABLED(CONFIG_CDROM_PKTCDVD_WCACHE);
18781878
int ret;
18791879

18801880
init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
@@ -1890,7 +1890,12 @@ static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
18901890
if (ret)
18911891
return ret;
18921892

1893-
buf[pd->mode_offset + 10] |= (!!set << 2);
1893+
/*
1894+
* use drive write caching -- we need deferred error handling to be
1895+
* able to successfully recover with this option (drive will return good
1896+
* status as soon as the cdb is validated).
1897+
*/
1898+
buf[pd->mode_offset + 10] |= (set << 2);
18941899

18951900
cgc.buflen = cgc.cmd[8] = 2 + ((buf[0] << 8) | (buf[1] & 0xff));
18961901
ret = pkt_mode_select(pd, &cgc);
@@ -2085,7 +2090,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
20852090
return -EIO;
20862091
}
20872092

2088-
pkt_write_caching(pd, USE_WCACHING);
2093+
pkt_write_caching(pd);
20892094

20902095
ret = pkt_get_max_speed(pd, &write_speed);
20912096
if (ret)

include/uapi/linux/pktcdvd.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@
2929
*/
3030
#define PACKET_WAIT_TIME (HZ * 5 / 1000)
3131

32-
/*
33-
* use drive write caching -- we need deferred error handling to be
34-
* able to successfully recover with this option (drive will return good
35-
* status as soon as the cdb is validated).
36-
*/
37-
#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
38-
#define USE_WCACHING 1
39-
#else
40-
#define USE_WCACHING 0
41-
#endif
42-
4332
/*
4433
* No user-servicable parts beyond this point ->
4534
*/

0 commit comments

Comments
 (0)