Message ID | 20230703135255.2202721-3-schnelle@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp553393vqx; Mon, 3 Jul 2023 07:11:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4cH+ib047iAytcTSECOKachuClhtPVGzP71CI7A2q6HrY43STUsR3WwwqQef3OvTl+2MX X-Received: by 2002:a17:90a:5107:b0:259:8305:5d6e with SMTP id t7-20020a17090a510700b0025983055d6emr11886767pjh.0.1688393470543; Mon, 03 Jul 2023 07:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688393470; cv=none; d=google.com; s=arc-20160816; b=wrIQQ1bERsFBTCjUn+6imQLu/tHu60TQC8yuZeS9IbA4TSpU1I5SHmZJa90/M6SKup wTR3Jk1yjoVI+V3L/ruhmruMLcpgshwhgzAZJPeSAk11YexNF5znkyVlcQi8Tg4H08wn Dz2DWhQ/hJQMHKzwgF8TyWys0aKpq6Osh5NGOiandjaLO0LSM3/kJmeEPu4/oKLABQ/b N/ok6xlcwuxW9VarXfdC8wtOalEYNcOXDNaYmpPucm/jDW8je34aJAoyfwhpi3zzxKfS nRGfaN5SYDpvLajM2CHyY70ZJPiFyDUco9t/LBPN4vBSWi6mLjBNoBHhu2FeYJMsv7XK E9UQ== 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=; fh=MF1qQLg0laKClmXe/aTx7xuDCb6JvNmW1GVHxaYRWxA=; b=oyw6VTvgxrhDGHFr3nAqYhEzYg6cinsTh2/3Rw7GSenl1jxblNWcVokLsDxe/yFlsZ bKsI9NTHYfB+6Xi2SMox0LMYIb1uGrfKBU9hc8/KtazBaHcC4sMEol0/5QxTU5JS1ycS oweoZ+PHuHm7TICa0FbygLgINe17vZkeQ0Tw5lvvVm/6hN1Fki5iOmHaz6N0whOaSf4P w02oASALkZznaCCkDGP5EdwbU35Z9XDVBRIwabS//KNmzVvZwKQkHmSyLm6RZ3jT55F6 QAVQI312EtggBnqy1rjagzx6zG19uMp6KwTh/VhLL0QNvB66OrZM/EMMmBpnWXX95S7I gikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=WSqkNri2; 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 h5-20020a17090acf0500b0026333edfaafsi11254116pju.128.2023.07.03.07.10.57; Mon, 03 Jul 2023 07:11:10 -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=WSqkNri2; 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 S230316AbjGCNxl (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Mon, 3 Jul 2023 09:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbjGCNxe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Jul 2023 09:53:34 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884B1173D; Mon, 3 Jul 2023 06:53:03 -0700 (PDT) Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 363DnIBt028914; Mon, 3 Jul 2023 13:53:01 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=WSqkNri2m9NCeihrVBP6yvMLLxokRAhAPwE5nq8IHC11BIj6hBy4kM/cLhGUPJ0Aws+L IaAOSJPcLoSi5mt6qdJ2cpRENfqcPgpkrqJeUWhx53xYIpQjYDeS8gk5ArkQS8Qtln0+ SmKrS3h6HipdWrqsb2yLg48vImYgVHGsw9LhTWBpGxjqaeN7bcH5TOd9Bxc4VjJFi9Sg /MDDJldL7sPoKpfq/cyP+J0ZfvcqayENH03fQU/tpkD9x0xJlhqCir6jP2oJy80ZWx52 XQ64MlU819bKKvphteaiy/V2AcuppDdgHvzs9E/x0xMHp2oVUR2+ck34S89nJXR1KZy3 hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rkyj20345-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jul 2023 13:53:00 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 363Do6g2032231; Mon, 3 Jul 2023 13:53:00 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rkyj2033k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jul 2023 13:53:00 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3639lk2o015520; Mon, 3 Jul 2023 13:52:58 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3rjbdds0dg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jul 2023 13:52:58 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 363DquFh20775468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jul 2023 13:52:56 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DF3920043; Mon, 3 Jul 2023 13:52:56 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 156D52004B; Mon, 3 Jul 2023 13:52:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 3 Jul 2023 13:52:56 +0000 (GMT) From: Niklas Schnelle <schnelle@linux.ibm.com> To: Bjorn Helgaas <bhelgaas@google.com> Cc: Arnd Bergmann <arnd@arndb.de>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 2/2] PCI/sysfs: Make I/O resource depend on HAS_IOPORT Date: Mon, 3 Jul 2023 15:52:55 +0200 Message-Id: <20230703135255.2202721-3-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230703135255.2202721-1-schnelle@linux.ibm.com> References: <20230703135255.2202721-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: OYsUJTNEEXc8g8Xp-t235-NITmdmGW0i X-Proofpoint-GUID: AiZlJ6jjpZ_9lAPf1U_VHBVqIkV4mYdl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-03_11,2023-06-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307030122 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770408871694735558?= X-GMAIL-MSGID: =?utf-8?q?1770408871694735558?= |
Series |
PCI: Handle HAS_IOPORT dependencies
|
|
Commit Message
Niklas Schnelle
July 3, 2023, 1:52 p.m. UTC
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 <arnd@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> --- 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,