Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2760413rwd; Mon, 22 May 2023 04:05:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5n/UtzXo//oj2OaqjxpckP8Wl7BclNoEEVLup5LCu8JMas1KTnQZxqXt6cpLak/KG385NJ X-Received: by 2002:a17:903:2310:b0:1ad:164:74fc with SMTP id d16-20020a170903231000b001ad016474fcmr14693973plh.20.1684753558914; Mon, 22 May 2023 04:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684753558; cv=none; d=google.com; s=arc-20160816; b=Mf8UigCTPiCnnNTDCIwyv4M48XImtq3OuTjb66ngFjULhUDddOAiT4F/tMHbt33IM6 cLXIlCYAwcDCo/bt/RtOBeQrUC8sAcJ0/g8wO2UK0vaY8zuoaToB/6t8mZYhNxNyhr7G tisyOK0q771Vrvf78UriHlmQxKCWUJKINFffEptUDk4qHXrvLeNeLXTvbSOheX5YKr31 bIQIY8by3Q1muDA5LMtA1+5YX1dw36iOqyldjZyYyv7E5XCb04R322FVOY05tKyBvH+Y DhN6S1fcF11laXdsotarQkHpMKTP8HrsDaCOvRVCiMNJ7M3ApHcYviBHQ3aku83qgh2L 3VUA== 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=kOVkRocUNzoCE3Ax5Q0vzHkYAKeyWtHflf+V2JFhZf0=; b=JAMTmm5xY53VjRM1mPoXl11elOo+dwFBhA5dffMsimhCWaOmoVRPdTJEzHLrr8QlIX vlok09d0xm1zM2ON2ugScs+bqEKZmmOCRQX2cGBWPDSO1TI/hOLQN1RD6Pw5/Rijuuxn NsZHrs4AVcrPozKZhOMYm8zGAFHfdOJwnq+XkKSLN13DMslnwu75vCLgo5Qmlxh/0E37 bKxrBqlo93D9IBatuN/0P/IX0uOVRkKvxOm2Itspmuwcbfido1Wfv2JcNtgOXAQA920y fL/9CQlokrusydz52gOCO4kbpop9fZRe4GFmvj/m0iBv6+4q4WUw6d7ZxkGqVIjZdWaW OAng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=H59bd4cB; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170902e54700b001aafb271d16si4660016plf.461.2023.05.22.04.05.45; Mon, 22 May 2023 04:05:58 -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=H59bd4cB; 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 S233049AbjEVKxX (ORCPT + 99 others); Mon, 22 May 2023 06:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232982AbjEVKwG (ORCPT ); Mon, 22 May 2023 06:52:06 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E104FE56; Mon, 22 May 2023 03:51:30 -0700 (PDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34M9qg9D015336; Mon, 22 May 2023 10:51:21 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=kOVkRocUNzoCE3Ax5Q0vzHkYAKeyWtHflf+V2JFhZf0=; b=H59bd4cB44i8p9lHZcNLtdBgO7LwkI4vcfWimglf/EirGSAG0UYGfuKSDVqMTedixpCx Eq5ic2rwAXfSS4JAvklRh2PvbdzwtIE8d4KKdXq19v7MRY/KhRpTUEtXRDMApDCUFBZr 4CXN1GElFtf5nDZq3KBP/7IKM3Tqc0reb2gjcA/sXYVBybrf+aKB4iQuFveMM5iI6Ipf +R4uAJv8tV7pLIsMm++BLpLvN/yvIFog3W6O6pfIQV+yLxYMSI26DqdyqtDMQyjuKiFM zCuQT2I7uhZbX6xKRRxxh8TDv9i8MuRNxiIuAIcjPg6KOI5s40WrZyZeUWVSmFY0NMw3 9Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqfq39r0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:20 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34M9cE0Z029654; Mon, 22 May 2023 10:51:20 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqfq39qyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:19 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34M3P0dq016258; Mon, 22 May 2023 10:51:18 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3qppdk0w99-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:51:18 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34MApCjB37356186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 May 2023 10:51:12 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7AA692004B; Mon, 22 May 2023 10:51:12 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2411A20043; Mon, 22 May 2023 10:51:12 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 22 May 2023 10:51:12 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Bjorn Helgaas Cc: Greg Kroah-Hartman , =?UTF-8?q?Uwe=20Kleine-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 v5 25/44] PCI/sysfs: Make I/O resource depend on HAS_IOPORT Date: Mon, 22 May 2023 12:50:30 +0200 Message-Id: <20230522105049.1467313-26-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522105049.1467313-1-schnelle@linux.ibm.com> References: <20230522105049.1467313-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: XA-F9FHMBXeah8fQ5YuIlUwTaeRSmasl X-Proofpoint-GUID: dUS_Pkqk5J8FLYkSzVrfagtH8ZX07pRa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-22_06,2023-05-22_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 impostorscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305220089 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, T_SCC_BODY_TEXT_LINE 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 If legacy I/O spaces are not supported simply return an error when trying to access them via pci_resource_io(). This allows inb() and friends to become undefined when they are known at compile time to be non-functional in a later patch. Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Acked-by: Bjorn Helgaas Signed-off-by: Niklas Schnelle --- drivers/pci/pci-sysfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index ab32a91f287b..d9eede2dbc0e 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count, bool write) { +#ifdef CONFIG_HAS_IOPORT struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); int bar = (unsigned long)attr->private; unsigned long port = off; @@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj, return 4; } return -EINVAL; +#else + return -ENXIO; +#endif } static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj, -- 2.39.2