From patchwork Fri Mar 10 16:07:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 67532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp967642wrd; Fri, 10 Mar 2023 08:28:21 -0800 (PST) X-Google-Smtp-Source: AK7set+yNnKqvYRRh40sYMQ6nVi2iiLRGLokpeziBBbiLOnnnqQsmVOE26YH0Awka85G2QmLsoR2 X-Received: by 2002:a17:903:2441:b0:19e:85e8:f78d with SMTP id l1-20020a170903244100b0019e85e8f78dmr31636011pls.65.1678465701161; Fri, 10 Mar 2023 08:28:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678465701; cv=none; d=google.com; s=arc-20160816; b=TaogjqaPajwXKSyg21NWe6Cif5HkzgrET7sq+boFSviDW5pGCFoWHASSb5bu2iGrMQ YUgBise+bNkyNIatg6q5RWXM5FwGZxGfEaQc6dmwxBTo6S4PJVZSmkUDrj8hHLJG1VRU 0dDAaCL/lGGI1dyTMPBBvU1GTm1S0KdJaCRWDjJbpR3wrFJKi4CpUguk19howBHXZnYR Nsr5wlAtgRWaGJ5vYurlKVx5u4e50hhv3qLiuXjTdllhfC5UpKDTyJoXLJzpa+kVvq6b ReDvj9kHFmDEBXhP+VT1iV2a+irjbolyCOP19qYtBM90Hh5zmTaPUNIixVpD2HfQpgr3 0wrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uORM3Xhzjyx5pSXtVFHzrrBAkab8IB4YL2yYQbG2PCU=; b=ebqlX3L4xuY+DihQQnA1QKQ/D0jjmoMkrwqQOwZxvV4ifbXESP0yaOP7AKWSFWd/oR wszbmTi5UyHfGSXqjooNkhVOhWS1YkKGY8CmsPjpimeizmkrrkqyZodSlJ9y9Ior2zep 6383ke1be8q+aUQ2MuAq1mJBBh/OFsHFXd1/Sxox9FPR1GPmhE4yG6tAcYNjzJXdA1k8 ZtB2WHXiJ8/vlAZZ5EjvBMCOq1ItUhvTAQbzmiYv7fu2eTKt5r1T6cblLWp7dMpxINlm 2M0+2eFbs+JBT/zOKojWyPcQDQrswTUz8S+vm0x9T7FHOCpU0Jkcs+VEIB5DaMlc/CNh goyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BP7Nw5QY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a170902d2c400b0019b0c65027csi260018plc.620.2023.03.10.08.28.08; Fri, 10 Mar 2023 08:28:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BP7Nw5QY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbjCJQQM (ORCPT + 99 others); Fri, 10 Mar 2023 11:16:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229945AbjCJQNG (ORCPT ); Fri, 10 Mar 2023 11:13:06 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D04D11EE95 for ; Fri, 10 Mar 2023 08:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678464497; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uORM3Xhzjyx5pSXtVFHzrrBAkab8IB4YL2yYQbG2PCU=; b=BP7Nw5QYbL+59j3DCNKdvyUh42RsjQOGufLzCXfan4Q5xl4KFPkYzUf1zRZt/DAdXHeX4f tLbMBCexKrUXfem/IikS1gX+zEZykKHccWL8PkrBU0VVyI/UxKgDFqZrVBepm9S90kcD2p XpDUlz0KZHGBdbGgatcZ0N84kX3l+To= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-vhIr2a09NJ-Bi14QG2KogA-1; Fri, 10 Mar 2023 11:08:11 -0500 X-MC-Unique: vhIr2a09NJ-Bi14QG2KogA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00B1938041DD; Fri, 10 Mar 2023 16:08:11 +0000 (UTC) Received: from thuth.com (unknown [10.45.224.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE54C492C3E; Fri, 10 Mar 2023 16:08:08 +0000 (UTC) From: Thomas Huth To: linux-kernel@vger.kernel.org, Arnd Bergmann Cc: 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, Christoph Hellwig Subject: [PATCH v2 4/5] pktcdvd: Remove CONFIG_CDROM_PKTCDVD_WCACHE from uapi header Date: Fri, 10 Mar 2023 17:07:56 +0100 Message-Id: <20230310160757.199253-5-thuth@redhat.com> In-Reply-To: <20230310160757.199253-1-thuth@redhat.com> References: <20230310160757.199253-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759998850904506640?= X-GMAIL-MSGID: =?utf-8?q?1759998850904506640?= 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 Signed-off-by: Thomas Huth Reviewed-by: Christoph Hellwig --- drivers/block/pktcdvd.c | 13 +++++++++---- include/uapi/linux/pktcdvd.h | 11 ----------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 2f1a92509271..5ae2a80db2c3 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 9cbb55d21c94..6a5552dfd6af 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 -> */