From patchwork Tue Mar 14 12:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 69562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1721103wrd; Tue, 14 Mar 2023 05:16:39 -0700 (PDT) X-Google-Smtp-Source: AK7set+CyVOIV+cnuKvameyJaqrB5TD4Eko/v+IlpPR6jyVWWebC8vQHNY8OWRTKJC+glwnokirf X-Received: by 2002:a05:6a20:918c:b0:d3:3e9b:4907 with SMTP id v12-20020a056a20918c00b000d33e9b4907mr13314353pzd.39.1678796199457; Tue, 14 Mar 2023 05:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678796199; cv=none; d=google.com; s=arc-20160816; b=E4fYCju3gdw3FXaVmt6SWEIfMUl3XmCgAtwlJgaln23NHKOQF8xkN/3BDYV2qEo3CO UhU3iwzkUrKoZ9KCfSGb8E4tFBD8TI+7qO8mMqYV9oq4Izd+t6h/eOTIXGQKM3PYdBOc AbKNKy8yyPr701AGNHkbs4K1vacO/UYg9qbcvB4IEmAoRh6jaaQjm7c1LV5XjqHmV+8Q KYLYSIICFJA2DEIiaaWopIHMOjepfrUFlaWArQQ/f2tKQV5QnkRnPNJabpH1BLsHttvB mGP2Pk1jPYuDkACb6qBsHdudo++YECzn+4Hqq43vzNgvDwTTQTBSgtkhmUvmovc6iEwz XfmQ== 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=92NbYBPz7jlfFaoRMTntmblYAguqsRrXvLfZffk/hrU=; b=qs2PjadGitEdLYKBzSXHoWcEhQTx98hii6kWgI+wjFvQO2pa0tx/btwvCLs3spc8f7 t73ySkQA2CLKzEFl1P/LdmNd+0XFtreQYT+rotr84RUmEPAd7pddMAHhRBKRH8o0BSRs 9Jesqc19hypqFzX+AtuTqkm/jeILSqLYsoZoleWJ9LXWXFduoeoFdJHVKU9aUQ31mVdI C4415jsVNYPDHZ7VY7wCmHD1aEyG9tGjmIrAzLOCaDu25F3hctjLAKQ9zC8dZZBeEpQr QU5LkRzjZGWNqgXteZ0CC24+0MjE22JcvJfLhl0t9VKkbxWf3cSK5768hjsYZfL/NoLT 0HKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nvwei7pW; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s63-20020a625e42000000b0062565210347si1621290pfb.275.2023.03.14.05.16.23; Tue, 14 Mar 2023 05:16:39 -0700 (PDT) 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=@ibm.com header.s=pp1 header.b=nvwei7pW; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbjCNMN3 (ORCPT + 99 others); Tue, 14 Mar 2023 08:13:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjCNMNQ (ORCPT ); Tue, 14 Mar 2023 08:13:16 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521EB1449E; Tue, 14 Mar 2023 05:12:44 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32EBR1W4011578; Tue, 14 Mar 2023 12:12:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=92NbYBPz7jlfFaoRMTntmblYAguqsRrXvLfZffk/hrU=; b=nvwei7pWhllBrUtU0CReFHHKO8i85DN0+w9oxqM48okTUnPeJt27XCNZtCbmYmTjYzBI L+daw6p3ZJs3VnNGXpuop47+4KH8b5t7N4NSQQ3IiAKkGqH249YnH1vrCoWMNIgwaPl5 MptKUUg7hgnnPInOpKa9FopYw6NEox4d4xpL87xcqZaXU8dqAKsdqCcQsfC2KjEvNPzT 4wznTGFdu0YyEKhghOcy4qRHdFywJ6M6RDd604SQOHXFcF2DXlmGHXa9Rik4OMcXuLhB 5OkhwqIFwmlpqSM+Dz7kNoHiC7y/tZWyQh1mxqna8J6cTFu4mNN/5eTnGoFO7olI3BGQ GQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3pap9ecaka-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:30 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32ECBcF4011076; Tue, 14 Mar 2023 12:12:30 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3pap9ecajg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:30 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 32E87EXF029926; Tue, 14 Mar 2023 12:12:28 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3p8gwfct6r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:12:27 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32ECCPre30409400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Mar 2023 12:12:25 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 895652007D; Tue, 14 Mar 2023 12:12:25 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27D6D2007C; Tue, 14 Mar 2023 12:12:25 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 14 Mar 2023 12:12:25 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Greg Kroah-Hartman Cc: Bjorn Helgaas , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Mauro Carvalho Chehab , Alan Stern , "Rafael J. Wysocki" , Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-pci@vger.kernel.org, Arnd Bergmann Subject: [PATCH v3 06/38] /dev/port: don't compile file operations without CONFIG_DEVPORT Date: Tue, 14 Mar 2023 13:11:44 +0100 Message-Id: <20230314121216.413434-7-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230314121216.413434-1-schnelle@linux.ibm.com> References: <20230314121216.413434-1-schnelle@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: rdPIP1zHTxu4vqzYQwBNwKrPxBfz2VMx X-Proofpoint-ORIG-GUID: d_FSJQitQFLLy6jyzuQ4RWY7pUQXpoIY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-14_04,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 phishscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303140103 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham 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?1760345403756709242?= X-GMAIL-MSGID: =?utf-8?q?1760345403756709242?= 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: 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 ffb101d349f0..d7fcf85b4df9 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) @@ -671,12 +673,14 @@ static const struct file_operations null_fops = { .uring_cmd = uring_cmd_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 static const struct file_operations zero_fops = { .llseek = zero_lseek,