Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4960BC64ED9 for ; Mon, 20 Feb 2023 06:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbjBTGUV (ORCPT ); Mon, 20 Feb 2023 01:20:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbjBTGUT (ORCPT ); Mon, 20 Feb 2023 01:20:19 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB42F8A75; Sun, 19 Feb 2023 22:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=l+6M2Hg2VWv7REExXj0y1+ocsKsaxPlFIc1mUwU0F2I=; b=OLNgiYt1OWea+X56z7nZmhL6k2 nr+HZO5U9UV5o/ENalIFE3xdmB6Ydtd5xIaQRLNoD15tkAHOT/JRBogymNzYlYjC+UzHeNjCc/wDl v3Xof0xl1ClYS/ePR1PRx8ADBsT6WrClWeEhFQJ2Po8binIIoxu/y4FvsnLrqY1rnChijmp0YyRtK S9ZuSCE70YOVgsggNpzQD2rnyjfRIaaaowgW/DQM/ToNzxq3laL8Hl0nWWQG448y+l+nfCzXhlHWA IrzYZ/r9jvmqP6KqGVO7miQgbsKPhz2VPtL2DrvtYElutUMh+VmIxUjRq65Sy4YiffthV4rvNPO4Y gM9lD5QA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pTzWy-0038A2-Cy; Mon, 20 Feb 2023 06:20:08 +0000 Date: Sun, 19 Feb 2023 22:20:08 -0800 From: Christoph Hellwig To: Thomas Huth Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , linux-arch@vger.kernel.org, Chas Williams <3chas3@gmail.com>, Palmer Dabbelt , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, Andrew Waterman , Albert Ou Subject: Re: [PATCH 4/4] Move USE_WCACHING to drivers/block/pktcdvd.c Message-ID: References: <20230217202301.436895-1-thuth@redhat.com> <20230217202301.436895-5-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230217202301.436895-5-thuth@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 17, 2023 at 09:23:01PM +0100, Thomas Huth wrote: > From: Palmer Dabbelt > > 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 -> */