Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp260077iol; Sat, 11 Jun 2022 03:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfapWVCmmdTXLbVjLyaT9ZVlNrlodq9862q/VzD2c/mTCr9T5UyxiyyJgwDH4a76aF9Wyt X-Received: by 2002:a17:906:52c7:b0:6ce:a880:50a3 with SMTP id w7-20020a17090652c700b006cea88050a3mr44525070ejn.437.1654944145457; Sat, 11 Jun 2022 03:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654944145; cv=none; d=google.com; s=arc-20160816; b=L4HAjAGamVN+0Y1CaKhpggMxNsRwOn7SVdmqGoHAdQ0tDMsIM5LwpTPzkqPe6DthZR 5D0vvL6f6LDWDXGhLKb4RLcPiHqRp7CCBxq8icroD2Lic+jLKvg0WT2gLuG3Q9Hc4RKY gVFOgBEFLwQ4ZwNPtdvPEnTsuo9MsVAKolY+PqFUwiWsgJnf+jql3C5kZmtV0+BOdFh0 acuz1KsZqfrtB4yhOgwlSqtfvUN8n49BTbyeMb/QWkQX4vu9p0731Ao4gkbzcaPA8AYq n1Y4fVJ2kCyIR2M9YKCne2kcPb6i/vxjxkl3mBmENMTQZn+LuGKivf5sy88hZG9XWsqJ jNog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KIxsSmffb8RfNqJlYqJ6d8OJHZPkWprEKP9BjZRzvY4=; b=ZC09yiVJk+bAJmd5+WbxcMovy1NmppbsHvi6A3KMUOJUurPK5U3mB2PWzyWTQt3Vom dmWZG/IQWr0rSrpHJ//k4jGQ82D8mSzfACZMCTOk0tKEorax6I7R/03ASdmjqGI6Pjlh 42/IAgrnCvnBjAnJ9LWbFknvwFL/NdD8UQvIVXZHoJeAJRKGXjP/9+nRX2LxoG9L2G+P ytOlapUHrQf2f/Yfx1F+YMfBo6YpctnGBg97gN3jf4sq7uT4tRKgFo9xD9UyUtTrvNGh chnLac0McLBIyzG/tk5I4T4ZjGpkqt2V65YM0uo71U0hD8DV+8jZOs3nDtNRhBvZ92nz glEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DmYimP8x; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i26-20020a1709067a5a00b0070fac9eaf73si1599262ejo.64.2022.06.11.03.41.59; Sat, 11 Jun 2022 03:42:25 -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=@gmail.com header.s=20210112 header.b=DmYimP8x; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbiFKK1M (ORCPT + 99 others); Sat, 11 Jun 2022 06:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiFKK1K (ORCPT ); Sat, 11 Jun 2022 06:27:10 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8D117E32; Sat, 11 Jun 2022 03:27:09 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id gl15so2384521ejb.4; Sat, 11 Jun 2022 03:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KIxsSmffb8RfNqJlYqJ6d8OJHZPkWprEKP9BjZRzvY4=; b=DmYimP8x9+fBNO5W9V+LPablLcvvdeYRzWgAyGF0whEQX/wYY7V7xjcwFUKEmTPA4c mpZwcvHCTA94+Rc/oh9sohMYfnkdY/QD/+ajvNzddutXAIRnHGaHfEdUiT7A6kIGR8VB 3hxsumzh0hOJO2uOzb5Kf5O7TuaeHjmPiTjMisReEAEHaIb5TQzgYdsUZ05rGi1KmXYk nvOvAaw+8EeVsJq8dqk6STcfHJxHMJn9cAwO+rqpoTQe4fhw6pMIwMxLREhi74AbadqK GO5nNxLEUnaDjjnuSKthP4JbD0kjff9Fpuox0s56DCAGKppd1bJ7+lCMRw3hpOEQK3jb +7zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KIxsSmffb8RfNqJlYqJ6d8OJHZPkWprEKP9BjZRzvY4=; b=sQqS6KWTdhhFzPntIjnW+GkqH8ANaINxKWyBoJkNK46iNYExtB2NtwVPZchB/17Q9R Z93MFEFGkh83j5s9pNI18bVOp1wZ6po9qNx3ruMNnwxVAEVTfs35sV6xVfKG2aYIP8Qi 2HX5+wk0GrrQVp2Skj02UHbihxLeJ6wpOhIlC9bsVCICLD/xlOsoNCFjBPP5O4yC5/tT emhhNt27xaU4JPEXrxiJpnO1NEoI2p8UES51KaRjnzJsBgorxzuVahptZk6+/xrh6WHo IEDVoXtfRZcF6uojR0gncKf93AnCNWMsXtsPMvfJhQMzUpy3sPyQu136i8Y2NaBGPmm3 WFpw== X-Gm-Message-State: AOAM533VzGJkYhSARxADkSJJB8S6DWM76kZV2AENWoGoy+8A4Eo9TuV5 l99jtGebKfPcUf7bSdS59botTmL+xImYH7lm7pg= X-Received: by 2002:a17:906:1193:b0:70d:cf39:a4db with SMTP id n19-20020a170906119300b0070dcf39a4dbmr38814493eja.44.1654943227473; Sat, 11 Jun 2022 03:27:07 -0700 (PDT) MIME-Version: 1.0 References: <20220610175655.776153-1-colin.foster@in-advantage.com> <20220610175655.776153-2-colin.foster@in-advantage.com> In-Reply-To: <20220610175655.776153-2-colin.foster@in-advantage.com> From: Andy Shevchenko Date: Sat, 11 Jun 2022 12:26:31 +0200 Message-ID: Subject: Re: [PATCH v9 net-next 1/7] mfd: ocelot: add helper to get regmap from a resource To: Colin Foster Cc: devicetree , Linux Kernel Mailing List , netdev , linux-arm Mailing List , "open list:GPIO SUBSYSTEM" , Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , Microchip Linux Driver Support , Linus Walleij , Wolfram Sang , Terry Bowman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Fri, Jun 10, 2022 at 7:57 PM Colin Foster wrote: > > Several ocelot-related modules are designed for MMIO / regmaps. As such, > they often use a combination of devm_platform_get_and_ioremap_resource and > devm_regmap_init_mmio. > > Operating in an MFD might be different, in that it could be memory mapped, > or it could be SPI, I2C... In these cases a fallback to use IORESOURCE_REG > instead of IORESOURCE_MEM becomes necessary. > > When this happens, there's redundant logic that needs to be implemented in > every driver. In order to avoid this redundancy, utilize a single function > that, if the MFD scenario is enabled, will perform this fallback logic. ... > +#include > +#include > +#include Since it's header the rule of thumb is to include headers this one is a direct user of. Here I see missed types.h Also missed forward declarations struct resource; ... > + if (!IS_ERR(regs)) Why not positive conditional? > + *map = devm_regmap_init_mmio(&pdev->dev, regs, config); > + else > + *map = ERR_PTR(ENODEV); Missed -. -- With Best Regards, Andy Shevchenko