From: Christoph Hellwig <hch@infradead.org>
To: Thomas Huth <thuth@redhat.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, Chas Williams <3chas3@gmail.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
Andrew Waterman <waterman@eecs.berkeley.edu>,
Albert Ou <aou@eecs.berkeley.edu>
Subject: Re: [PATCH 4/4] Move USE_WCACHING to drivers/block/pktcdvd.c
Date: Sun, 19 Feb 2023 22:20:08 -0800 [thread overview]
Message-ID: <Y/MRGCxfWpm73r79@infradead.org> (raw)
In-Reply-To: <20230217202301.436895-5-thuth@redhat.com>
On Fri, Feb 17, 2023 at 09:23:01PM +0100, Thomas Huth wrote:
> From: Palmer Dabbelt <palmer@dabbelt.com>
>
> I don't think this was ever intended to be exposed to userspace, but
> it did require an "#ifdef CONFIG_*". Since the name is kind of
> generic and was only used in one place, I've moved the definition to
> the one user.
I'd just remove USE_WCACHING entirel with something like:
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 2f1a92509271c4..5ae2a80db2c341 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1869,12 +1869,12 @@ static noinline_for_stack int pkt_probe_settings(struct pktcdvd_device *pd)
/*
* enable/disable write caching on drive
*/
-static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
- int set)
+static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd)
{
struct packet_command cgc;
struct scsi_sense_hdr sshdr;
unsigned char buf[64];
+ bool set = IS_ENABLED(CONFIG_CDROM_PKTCDVD_WCACHE);
int ret;
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,
if (ret)
return ret;
- buf[pd->mode_offset + 10] |= (!!set << 2);
+ /*
+ * use drive write caching -- we need deferred error handling to be
+ * able to successfully recover with this option (drive will return good
+ * status as soon as the cdb is validated).
+ */
+ buf[pd->mode_offset + 10] |= (set << 2);
cgc.buflen = cgc.cmd[8] = 2 + ((buf[0] << 8) | (buf[1] & 0xff));
ret = pkt_mode_select(pd, &cgc);
@@ -2085,7 +2090,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
return -EIO;
}
- pkt_write_caching(pd, USE_WCACHING);
+ pkt_write_caching(pd);
ret = pkt_get_max_speed(pd, &write_speed);
if (ret)
diff --git a/include/uapi/linux/pktcdvd.h b/include/uapi/linux/pktcdvd.h
index 9cbb55d21c94af..6a5552dfd6af4e 100644
--- a/include/uapi/linux/pktcdvd.h
+++ b/include/uapi/linux/pktcdvd.h
@@ -29,17 +29,6 @@
*/
#define PACKET_WAIT_TIME (HZ * 5 / 1000)
-/*
- * use drive write caching -- we need deferred error handling to be
- * able to successfully recover with this option (drive will return good
- * status as soon as the cdb is validated).
- */
-#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
-#define USE_WCACHING 1
-#else
-#define USE_WCACHING 0
-#endif
-
/*
* No user-servicable parts beyond this point ->
*/
next prev parent reply other threads:[~2023-02-20 6:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 20:22 [PATCH 0/4] Remove #ifdef CONFIG_* from uapi headers (2023 edition) Thomas Huth
2023-02-17 20:22 ` [PATCH 1/4] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Thomas Huth
2023-02-20 6:14 ` Christoph Hellwig
2023-02-17 20:22 ` [PATCH 2/4] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Thomas Huth
2023-02-17 20:57 ` Arnd Bergmann
2023-02-20 6:15 ` Christoph Hellwig
2023-02-17 20:23 ` [PATCH 3/4] Move bp_type_idx to include/linux/hw_breakpoint.h Thomas Huth
2023-02-17 21:01 ` Arnd Bergmann
2023-02-20 6:15 ` Christoph Hellwig
2023-02-17 20:23 ` [PATCH 4/4] Move USE_WCACHING to drivers/block/pktcdvd.c Thomas Huth
2023-02-17 21:08 ` Arnd Bergmann
2023-02-20 6:20 ` Christoph Hellwig [this message]
2023-02-17 21:11 ` [PATCH 0/4] Remove #ifdef CONFIG_* from uapi headers (2023 edition) Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/MRGCxfWpm73r79@infradead.org \
--to=hch@infradead.org \
--cc=3chas3@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=thuth@redhat.com \
--cc=waterman@eecs.berkeley.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).