From mboxrd@z Thu Jan 1 00:00:00 1970 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 74BEFC4332F for ; Wed, 29 Dec 2021 10:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239730AbhL2K0C (ORCPT ); Wed, 29 Dec 2021 05:26:02 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55932 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231732AbhL2K0B (ORCPT ); Wed, 29 Dec 2021 05:26:01 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BT76LOq030283; Wed, 29 Dec 2021 10:25:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=LfGyH4GDskxin+coKtlA3vbQM36+89KqWNVcmXSF8W0=; b=mflE2cyytkG9Q/WUZtx7ovtq9ccBoAHBANBEfJuG8PdjftSebyQ2jDJaBDmjubI82hGW 93ZBO6vWATGyfAt1cY3U9ArcEunwGBZy+/PUejCOuxoSqab5gQAbp45C2KWwUihixite KL79xyeFwX2GrUrWkdKepIcYSAWzueb3DmBcywreiE0IpjIqkNK7UjpAsp7Lf/4mhsQt FLnhSXuKjIEMf8rr9bVODJfEPduZOaBqwX/utRni/IvrZOaQUegP2nxh+a4Dtc6qKacy gcifblxR0oUm4IgeCTO6k8LbWUUpWcfgA4WShX1NA3Jmd6RZbYnbS2v41u0c/zIdHRMn tQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d7xdut6kx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:20 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BTA9QKZ031427; Wed, 29 Dec 2021 10:25:19 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d7xdut6js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:19 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BTA7Dhe022628; Wed, 29 Dec 2021 10:25:16 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 3d5tx9mjsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:16 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BTAPD0x39584226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Dec 2021 10:25:14 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4CECAE064; Wed, 29 Dec 2021 10:25:13 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8271AE05A; Wed, 29 Dec 2021 10:25:12 +0000 (GMT) Received: from sig-9-145-13-177.uk.ibm.com (unknown [9.145.13.177]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Dec 2021 10:25:12 +0000 (GMT) Message-ID: Subject: Re: [RFC 30/32] /dev/port: don't compile file operations without CONFIG_DEVPORT From: Niklas Schnelle To: Greg Kroah-Hartman Cc: Arnd Bergmann , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org Date: Wed, 29 Dec 2021 11:25:12 +0100 In-Reply-To: References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-31-schnelle@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CONH9YRiE6zUaNV_ldL6uBzMkmByWy47 X-Proofpoint-ORIG-GUID: 8hmI9OQZCwEaLbSCMb7YKm3rBHuILRIK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-29_03,2021-12-29_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 clxscore=1015 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112290054 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-12-28 at 09:17 +0100, Greg Kroah-Hartman wrote: > On Mon, Dec 27, 2021 at 05:43:15PM +0100, Niklas Schnelle wrote: > > In the future inb() and friends will not be available when compiling > > with CONFIG_HAS_IOPORT=n so we must only try to access them here if > > CONFIG_DEVPORT is set which depends on HAS_IOPORT. > > > > Co-developed-by: Arnd Bergmann > > Signed-off-by: Arnd Bergmann > > Signed-off-by: Niklas Schnelle > > --- > > drivers/char/mem.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > > index cc296f0823bd..c1373617153f 100644 > > --- a/drivers/char/mem.c > > +++ b/drivers/char/mem.c > > @@ -402,6 +402,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma) > > return 0; > > } > > > > +#ifdef CONFIG_DEVPORT > > static ssize_t read_port(struct file *file, char __user *buf, > > size_t count, loff_t *ppos) > > { > > @@ -443,6 +444,7 @@ static ssize_t write_port(struct file *file, const char __user *buf, > > *ppos = i; > > return tmp-buf; > > } > > +#endif > > > > static ssize_t read_null(struct file *file, char __user *buf, > > size_t count, loff_t *ppos) > > @@ -665,12 +667,14 @@ static const struct file_operations null_fops = { > > .splice_write = splice_write_null, > > }; > > > > -static const struct file_operations __maybe_unused port_fops = { > > +#ifdef CONFIG_DEVPORT > > +static const struct file_operations port_fops = { > > .llseek = memory_lseek, > > .read = read_port, > > .write = write_port, > > .open = open_port, > > }; > > +#endif > > Why is this #ifdef needed if it is already __maybe_unused? Because read_port() calls inb() and write_port() calls outb() they wouldn't compile once these are no longer defined. Then however the read_port/write_port symbols in the struct initialization above couldn't be resolved. > > In looking closer, this change could be taken now as the use of this > variable already is behind this same #ifdef statement, right? Yes > > thanks, > > greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C11CC433EF for ; Wed, 29 Dec 2021 10:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ekaMsYu4rnQvAyWcP0J8UqVE7zq2/0l1a9e4DfbP9kk=; b=iNpMlLpV+Ykjx4 CX777TcpdtTsqdHOghqhPmMzkRU4iZfg256P0sh3GZTBXVF8Pg86kub2pRrbp9ahu6UTxRm9Yw72P 922YKRKLk4fkUlpnAbD1hkUrE46MeIpkAjjR8Z7DrbqrzsUi7dWfywFIrlBq8F9s0yuWSfjwshOdo fVR/vNZkMdDU6VauuCyzWtCHxLYsflXon3p3+ePWY+wa9br3eG4G5zKWkNEQnwdANRseUv+u37GRp hjGqPWtWg/70GKraYCn7NZCFla5tKtRjTsUikjc6Ffk/gIceoyQbGexTgDD/2f9CVLPXO977cAGkU y4kRxDmBvupVadkM3clw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2W9g-002cXb-Ua; Wed, 29 Dec 2021 10:26:00 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2W9e-002cXD-JM for linux-riscv@lists.infradead.org; Wed, 29 Dec 2021 10:26:00 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BT76LOq030283; Wed, 29 Dec 2021 10:25:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=LfGyH4GDskxin+coKtlA3vbQM36+89KqWNVcmXSF8W0=; b=mflE2cyytkG9Q/WUZtx7ovtq9ccBoAHBANBEfJuG8PdjftSebyQ2jDJaBDmjubI82hGW 93ZBO6vWATGyfAt1cY3U9ArcEunwGBZy+/PUejCOuxoSqab5gQAbp45C2KWwUihixite KL79xyeFwX2GrUrWkdKepIcYSAWzueb3DmBcywreiE0IpjIqkNK7UjpAsp7Lf/4mhsQt FLnhSXuKjIEMf8rr9bVODJfEPduZOaBqwX/utRni/IvrZOaQUegP2nxh+a4Dtc6qKacy gcifblxR0oUm4IgeCTO6k8LbWUUpWcfgA4WShX1NA3Jmd6RZbYnbS2v41u0c/zIdHRMn tQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d7xdut6kx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:20 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1BTA9QKZ031427; Wed, 29 Dec 2021 10:25:19 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3d7xdut6js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:19 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1BTA7Dhe022628; Wed, 29 Dec 2021 10:25:16 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma02fra.de.ibm.com with ESMTP id 3d5tx9mjsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Dec 2021 10:25:16 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1BTAPD0x39584226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Dec 2021 10:25:14 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4CECAE064; Wed, 29 Dec 2021 10:25:13 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8271AE05A; Wed, 29 Dec 2021 10:25:12 +0000 (GMT) Received: from sig-9-145-13-177.uk.ibm.com (unknown [9.145.13.177]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Dec 2021 10:25:12 +0000 (GMT) Message-ID: Subject: Re: [RFC 30/32] /dev/port: don't compile file operations without CONFIG_DEVPORT From: Niklas Schnelle To: Greg Kroah-Hartman Cc: Arnd Bergmann , Bjorn Helgaas , John Garry , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org, linux-csky@vger.kernel.org Date: Wed, 29 Dec 2021 11:25:12 +0100 In-Reply-To: References: <20211227164317.4146918-1-schnelle@linux.ibm.com> <20211227164317.4146918-31-schnelle@linux.ibm.com> X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CONH9YRiE6zUaNV_ldL6uBzMkmByWy47 X-Proofpoint-ORIG-GUID: 8hmI9OQZCwEaLbSCMb7YKm3rBHuILRIK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-29_03,2021-12-29_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 clxscore=1015 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112290054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211229_022558_684529_30FC2049 X-CRM114-Status: GOOD ( 26.53 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, 2021-12-28 at 09:17 +0100, Greg Kroah-Hartman wrote: > On Mon, Dec 27, 2021 at 05:43:15PM +0100, Niklas Schnelle wrote: > > In the future inb() and friends will not be available when compiling > > with CONFIG_HAS_IOPORT=n so we must only try to access them here if > > CONFIG_DEVPORT is set which depends on HAS_IOPORT. > > > > Co-developed-by: Arnd Bergmann > > Signed-off-by: Arnd Bergmann > > Signed-off-by: Niklas Schnelle > > --- > > drivers/char/mem.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/char/mem.c b/drivers/char/mem.c > > index cc296f0823bd..c1373617153f 100644 > > --- a/drivers/char/mem.c > > +++ b/drivers/char/mem.c > > @@ -402,6 +402,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma) > > return 0; > > } > > > > +#ifdef CONFIG_DEVPORT > > static ssize_t read_port(struct file *file, char __user *buf, > > size_t count, loff_t *ppos) > > { > > @@ -443,6 +444,7 @@ static ssize_t write_port(struct file *file, const char __user *buf, > > *ppos = i; > > return tmp-buf; > > } > > +#endif > > > > static ssize_t read_null(struct file *file, char __user *buf, > > size_t count, loff_t *ppos) > > @@ -665,12 +667,14 @@ static const struct file_operations null_fops = { > > .splice_write = splice_write_null, > > }; > > > > -static const struct file_operations __maybe_unused port_fops = { > > +#ifdef CONFIG_DEVPORT > > +static const struct file_operations port_fops = { > > .llseek = memory_lseek, > > .read = read_port, > > .write = write_port, > > .open = open_port, > > }; > > +#endif > > Why is this #ifdef needed if it is already __maybe_unused? Because read_port() calls inb() and write_port() calls outb() they wouldn't compile once these are no longer defined. Then however the read_port/write_port symbols in the struct initialization above couldn't be resolved. > > In looking closer, this change could be taken now as the use of this > variable already is behind this same #ifdef statement, right? Yes > > thanks, > > greg k-h _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv