Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3407459rdb; Wed, 13 Sep 2023 11:02:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9vonTVBTIqUI72txijtF80pkF1S1cFPv3F86CWx9HHmU1gGZniof1s5XCn7i+yf2wQAoG X-Received: by 2002:a17:90b:190e:b0:26d:2198:6117 with SMTP id mp14-20020a17090b190e00b0026d21986117mr2867857pjb.13.1694628144979; Wed, 13 Sep 2023 11:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694628144; cv=none; d=google.com; s=arc-20160816; b=ZMJMj6HTmYbI2lFV1sqK3BMNKNuGzIE8bs5HL9Se4mm/u9WWzHYA8gu+oQn1KFdEef BOjW9/y+/AqgC37f/1f9Cq7uKLQc/4U3SGDea+ta8FlDjQPu4zqoDGK5pqJBtTsRiyWT Yg/oBdhlyKTdOxEqDx5tczyBZ3wucyxnrnej7wzZqiVPI3BGgTKThgH5cdo61W5X0VjN hAtWlRQZkMcdX7q47WpSQzSB7gXcLWdSWARqi4a8AmfQA7CiP6fuFacMiyDUvDGrxLnJ 2uz+aLBakNL1dBkmQXAmEQnFqulShg32t+dEISBJi8zlbJGRUN0Vxw3o/fald2N7eaXH 9zcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature; bh=+EjfL09es/bo7dJMHGcN3eMoCICIbQlrFE3psUWS/0U=; fh=sI4r+OhhO078PrCj8rCarJIcZs6qUiM8dmBBtyz3CzU=; b=HQr8QuwAIetkwfa3OmYxavZV0TU1gGcRbjTrZjDMoB1fAWnax762ZJM4NVGNssK0hA DiyYDbOlxheaieRiVg9EfXNrguQ12XeNebaR0lF5WKQ9c5SMoxflT+ejiM7wIhm8ZC+P FD2rM15HDDVXyAoFtstsVLc5S29UWjomO3+hrz9kPugwL2FTSyXVGDXVa5GAClHY+Z8g RvM8OcwzjtGo7l7s7LsWXlYffV5W3ln/LlHchzP1xWq/n47gRZvfpNtlNrZzmGUCRwpV QyvwtuEcXAMssVyXDubB9RYC3uxFJM6CFllG2deSRdJEsBop891ZGYMvBpwnR1iiYKDR rDcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IPmOZRYg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e5-20020a17090a804500b002681dc4472esi1920007pjw.134.2023.09.13.11.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 11:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IPmOZRYg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 6C1AB81F88D0; Wed, 13 Sep 2023 11:02:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbjIMSCI (ORCPT + 99 others); Wed, 13 Sep 2023 14:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjIMSCH (ORCPT ); Wed, 13 Sep 2023 14:02:07 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 267F419AF for ; Wed, 13 Sep 2023 11:02:03 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1560C433C9 for ; Wed, 13 Sep 2023 18:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694628122; bh=JN7lHLS1BCA7WmhHqTgRkEkyRayhnajLCQX5GGmGnlY=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=IPmOZRYgD3UzyQ+ByzTorIC+Y021pd0FO+Qkz6Cqcmz4oehCEbaSYHFQV1czN6pfD dWnaj4Q7JLl9mIMrXddpgL+wCL/YvQekSMexHx7rnW0Sq/rw1zw6kQHJDKKDljouYL lPk0Rmu23VmQO2v33LAQY/RAHiXhTeYtwbmTEtrrAV14UufcWVgyDOnbZ1dSFvxVsK pCCIzkIF2zOWHmo2aZG1cD3UTgD05lx6IQUZK1wU20gcbaB5H/Z5PxOaWO61wi+d/2 XdbY12gN9d8dNdxAj1jaqkOlyEACdA6Ne2ohVKcT6OlOCLZHfzeS3DGeQQdTH/6Ss7 EMlMTwR89zHkQ== Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 6BAAA27C0054; Wed, 13 Sep 2023 14:02:01 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Wed, 13 Sep 2023 14:02:01 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugeskhgvrhhnvghlrdhorhhgqeenucggtf frrghtthgvrhhnpedvveeigfetudegveeiledvgfevuedvgfetgeefieeijeejffeggeeh udegtdevheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrrhhnugdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidquddvkeehudej tddvgedqvdekjedttddvieegqdgrrhhnugeppehkvghrnhgvlhdrohhrghesrghrnhgusg druggv X-ME-Proxy: Feedback-ID: i36794607:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 0C3C6B60089; Wed, 13 Sep 2023 14:02:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-745-g95dd7bea33-fm-20230905.001-g95dd7bea Mime-Version: 1.0 Message-Id: <83c58cdc-b96a-40c3-bed1-767e9e832893@app.fastmail.com> In-Reply-To: <79be8582-2395-42c7-92ae-29d9e4c4c33b@mev.co.uk> References: <20230913112032.90618-1-abbotti@mev.co.uk> <20230913112032.90618-10-abbotti@mev.co.uk> <79be8582-2395-42c7-92ae-29d9e4c4c33b@mev.co.uk> Date: Wed, 13 Sep 2023 20:01:40 +0200 From: "Arnd Bergmann" To: "Ian Abbott" , linux-kernel@vger.kernel.org Cc: "Niklas Schnelle" Subject: Re: [PATCH 09/13] comedi: ni_mio_common: Conditionally use I/O port or MMIO Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 11:02:11 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email On Wed, Sep 13, 2023, at 17:45, Ian Abbott wrote: > On 13/09/2023 13:17, Arnd Bergmann wrote: >> On Wed, Sep 13, 2023, at 13:20, Ian Abbott wrote: >>> >>> The changes make it possible to build the ni_pcimio module even if the >>> port I/O functions have not been declared. (The ni_atmio and ni_mio_cs >>> modules do still require the port I/O functions to be declared.) >> >> I think this all works, but there is probably a simpler way to >> achieve the same: >> >>> +#ifdef PCIDMA >>> + >>> static void ni_writel(struct comedi_device *dev, unsigned int data, int reg) >>> { >>> - if (dev->mmio) >>> - writel(data, dev->mmio + reg); >>> - else >>> - outl(data, dev->iobase + reg); >>> + writel(data, dev->mmio + reg); >>> } >>> >>> >>> +#else /* PCIDMA */ >>> + >>> +static void ni_writel(struct comedi_device *dev, unsigned int data, int reg) >>> +{ >>> + outl(data, dev->iobase + reg); >>> +} >> >> We already have an abstraction for this using iowrite32(), >> which turns into either writel() or outl() depending on the >> argument, so you could just use pci_iomap() or ioport_map() >> to turn port numbers into tokens suitable for the common >> helper. > > It would affect three modules, and there are similar changes that could > be made to other modules, so I think I'll put that suggestion on hold > for now. I'd also like to get rid of the '#include "ni_mio_common.c"' > nonsense at some point, but that's a big job! Sure, that's fine, I just thought I'd mention it in case you were looking for a nicer implementation. I wouldn't have done the current series to start with since there is not a huge amount of value in running these drivers on obscure architectures without HAS_IOPORT, but your changes are otherwise completely sensible. Arnd