From patchwork Mon May 22 10:50:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 97260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1353742vqo; Mon, 22 May 2023 03:53:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4R/910asVfYumExuRKceoFez4OXIpn555MuVycHbTWYX/Yu2HgXWl/iekMWu8EIDRD6SDo X-Received: by 2002:a05:6a21:3291:b0:10b:fb4:ff33 with SMTP id yt17-20020a056a21329100b0010b0fb4ff33mr5582853pzb.25.1684752824936; Mon, 22 May 2023 03:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684752824; cv=none; d=google.com; s=arc-20160816; b=Co70D8MgVkqfoMB/ZDIs1tHgx4qYCaqMPFTX5CadgKmV42Kd/B9+ZeBbIdu4UTbQF1 mEQ/gygKe9PvnhNhWnPpvEraetz1EUgf4du4jYB/a05T8CoGiQJgfKJXRWhQbHg712qI NEceR3f5s0snLeT0v/BDYCRRlosI9LI8TF7NIXVx/S/opE9n4BfjdQS7UkvmL8e+hTlF bHK45VuevrPrFBEwKicaqgURLR6Trm10xzRVaKjKtsw2gBDhaq1zB3SU54gU4in4in73 lQ9h1VOm89gWO+ZGM1WdGHWToKav5UWgWK+FwMGTeD6czQq5hPhgroUyDriUdxRH1aaR QlgA== 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=Q9uKm/ITOeSbSR3pwgYcO9bIF+6IaBzH2bkgdFhfvN8=; b=01BpjJDZnmESS0AVBzbe5n3lY0FtxAvNxYinx+gyPb6hUL6bFw8NT4/oHgw4QcVmoe XPYA41ZsBsRPmWZXSvyI5OWqoErrLxxMCg+85u7Bi+3zGg9UmDvKTpXgPpNXJ7D1If4u z0CGMbaJtopDFyea3l93Da5JiIKVmPSIWYnltwdKxE5NgVmSfHgFSUj8l9t9Zw/QvJzV Rl5ZC/I/Jr1kIS+8VgasaYK5uZ4dbKgzC8gPw4UTq/nhswMNkQIuDfPAmmxj78l9LHle ktVri0fn6P5Iuh4fKiLWEQwMO9qWhkOi/q1pGcOIFGY2xViqQ9MRiYdpf7nVJ+NfKLUd eu1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=DYQLxHh1; 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 t24-20020a639558000000b0053072cbae69si42560pgn.169.2023.05.22.03.53.31; Mon, 22 May 2023 03:53:44 -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=DYQLxHh1; 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 S232956AbjEVKv5 (ORCPT + 99 others); Mon, 22 May 2023 06:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbjEVKvi (ORCPT ); Mon, 22 May 2023 06:51:38 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E373FE; Mon, 22 May 2023 03:51:18 -0700 (PDT) Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34M9rw7J028674; Mon, 22 May 2023 10:50:58 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=Q9uKm/ITOeSbSR3pwgYcO9bIF+6IaBzH2bkgdFhfvN8=; b=DYQLxHh1FXKGq60rxJ0I3nnfWTJ1Ut18r9eXBqWy57i1AXQNOG6nwd5GcNRmdG0Wdkbd mcgZSGM0j7lcfpzgm1+pFwrjJA0dij1YQ0yrUfK9Exn9spggKEYCrrRDFGgvYDUgPRW6 x9f9xi7EIrPxCevsUnPLgToTyCnti6X3QGUH9WYOzqLKI+tO+kRU0CdAHT6SExA0YPFO qKUuVrLbHQakAjojtL/MOt0vLMIerY7orpwtUDW8J38aQQYXtoUZgbOiR9Fsgpi3b+9i uFG1FrfhHTx+6pA8pfr/3Ked9F9JQXUhthf/8MnC3u7k1EvuMnUM8ZIa7BFidsDE5nf6 IA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqee6tdh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:50:58 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34MAbZGT013695; Mon, 22 May 2023 10:50:57 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qqee6tdgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:50:57 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34M3tMXN008210; Mon, 22 May 2023 10:50:55 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma02fra.de.ibm.com (PPS) with ESMTPS id 3qppcs8s0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 22 May 2023 10:50:55 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34MAorUq30409294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 May 2023 10:50:53 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F8CD2004B; Mon, 22 May 2023 10:50:53 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8C7E20040; Mon, 22 May 2023 10:50:52 +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:50:52 +0000 (GMT) From: Niklas Schnelle To: Arnd Bergmann , Corey Minyard Cc: Greg Kroah-Hartman , 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, Corey Minyard , Arnd Bergmann , openipmi-developer@lists.sourceforge.net Subject: [PATCH v5 04/44] char: ipmi: handle HAS_IOPORT dependencies Date: Mon, 22 May 2023 12:50:09 +0200 Message-Id: <20230522105049.1467313-5-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 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PAu3-NLEeCNw1KavPwUxfMEYo_9R07Y2 X-Proofpoint-ORIG-GUID: tYEBZCUv5Y4Xq7BIxZ1_QfPsRQM0g9qJ 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 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=823 clxscore=1015 impostorscore=0 mlxscore=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766591378406906869?= X-GMAIL-MSGID: =?utf-8?q?1766591378406906869?= In a future patch HAS_IOPORT=n will result in inb()/outb() and friends not being declared. We thus need to add this dependency and ifdef sections of code using inb()/outb() as alternative access methods. Acked-by: Corey Minyard Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Niklas Schnelle --- drivers/char/ipmi/Makefile | 11 ++++------- drivers/char/ipmi/ipmi_si_intf.c | 3 ++- drivers/char/ipmi/ipmi_si_pci.c | 3 +++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile index cb6138b8ded9..e0944547c9d0 100644 --- a/drivers/char/ipmi/Makefile +++ b/drivers/char/ipmi/Makefile @@ -5,13 +5,10 @@ ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \ ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \ - ipmi_si_port_io.o ipmi_si_mem_io.o -ifdef CONFIG_PCI -ipmi_si-y += ipmi_si_pci.o -endif -ifdef CONFIG_PARISC -ipmi_si-y += ipmi_si_parisc.o -endif + ipmi_si_mem_io.o +ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o +ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o +ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index abddd7e43a9a..edbbdb804913 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io) } if (!io->io_setup) { - if (io->addr_space == IPMI_IO_ADDR_SPACE) { + if (IS_ENABLED(CONFIG_HAS_IOPORT) && + io->addr_space == IPMI_IO_ADDR_SPACE) { io->io_setup = ipmi_si_port_setup; } else if (io->addr_space == IPMI_MEM_ADDR_SPACE) { io->io_setup = ipmi_si_mem_setup; diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c index 74fa2055868b..b83d55685b22 100644 --- a/drivers/char/ipmi/ipmi_si_pci.c +++ b/drivers/char/ipmi/ipmi_si_pci.c @@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev, } if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) { + if (!IS_ENABLED(CONFIG_HAS_IOPORT)) + return -ENXIO; + io.addr_space = IPMI_IO_ADDR_SPACE; io.io_setup = ipmi_si_port_setup; } else {