Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4054175pxb; Tue, 10 Nov 2020 06:56:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJd0CRQJgEoR5gAxQKpzf3E/Uft81nYWgyvUBiJ8JEQVgy37DKU/XQEjYAoreJRzTej6wx X-Received: by 2002:a17:906:2a4b:: with SMTP id k11mr21519332eje.467.1605020168841; Tue, 10 Nov 2020 06:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605020168; cv=none; d=google.com; s=arc-20160816; b=iLiLqFdMxVYi2UkjUGpPRltQ9SkkjHgOOp1Zaz06gVso2VK6/xpn6dyuH917EzMAPV lIfsD9FIwBV/a1+ZoMnIQqTjNqJvYYJSXaRgv8gh9wCvCpT1ZEuRe6lKWPyWM7oq/Lnx buBGwJCD3T71GIWrOD666qDbkaekBrCTD2X7dXyM0FxIaJrBelL+JvGw39M08E/0oehd XEuqb0EWS2ssEvvQtioVJdizm9dvw+xGvNeSu1lQRXce3DJlHhY93tk+t9swkLo5TS/B hOVoQCF6d2gPHZLaBDOQIjarLrwxNGG3I6MPmYkYGAf9AjK4ee+bCD+vDi2fa0dLJRQl OFTA== 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=BiXKJCfFkLckk0QWi3TCRn5PbMUrC26oLIfgwcLzd+Q=; b=EPdR79q/g9QIiTgp1jRGM4PVsB8QN2myvOsm2i/gfIcfSLqOQx5K55r+q7Vzsw+E/W EOpJycgd//zXO4n9BCdMr7YD4TC0oEHo8fx41IycFVT5mkoHzinea33BSLj1MRxr8gql jq5FhymH/yx+GBgwgihT/IyohHUNFncBep31q2jMgHPF0FImWF/u/sylc6hA313ZseaO ZgaaRzHdEFphSiKypwRv9mQQgW0M8j9s71tle+fyRm1vJmQyaq1DnzEXSPWZJXMKXcrn sTZoDfeMtYAqJQs85MWpnqnmpffbKze2v3rYTuLFqUBU70oUtdgHBNkYNvpApfyqzUJ7 oeYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=kcHocmGB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si9867788edu.115.2020.11.10.06.55.45; Tue, 10 Nov 2020 06:56:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=kcHocmGB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730968AbgKJOwN (ORCPT + 99 others); Tue, 10 Nov 2020 09:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730345AbgKJOwM (ORCPT ); Tue, 10 Nov 2020 09:52:12 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8313FC0613D1 for ; Tue, 10 Nov 2020 06:52:12 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id 7so17964335ejm.0 for ; Tue, 10 Nov 2020 06:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BiXKJCfFkLckk0QWi3TCRn5PbMUrC26oLIfgwcLzd+Q=; b=kcHocmGBBnCROE3rCMMwA6XbZyw9sxTQm85i46syryc6+zXP7qG5PCFcj8yXFM0R9E r0qNfpTWPg1RZwPnLteh8uR3IZ4D63vxpoauwJM6tvc+W8QH1yUoT+KmyZg4z/4AHg4Q WN5ErfebNRBpIPaNGB4GAsR8PlvR8l4y6CZrCrZVQQf1o0Ws1oQ8cen3pWGZQ1/sPwm0 krEgCKwYOG+cDqGQep5moWLaZdi+r4EXg9AIZ6oG2AP/YDwJnO3crIR+E9vb35PeXhud WXSmQvLG65+sqpZHzcnztgfVgL9oDPiClULfGsRH899OIEKbstG6Y7BFYQ3fgiIcrt1K 6qxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BiXKJCfFkLckk0QWi3TCRn5PbMUrC26oLIfgwcLzd+Q=; b=KTDFhx6gNdDhPO03/Hb1K0GMLSO4EkHKqwXEvgnj3ExUlUw+PoKZ1AiuN+fIhnsQPP KDrFPqXLLwhgUhO/b+oDPChMpNYfxRPTXHcWqRIz4XNCJz7hpMnskTdUfwD2OYG8NhgR X0SVUN1ZVFu9SNZhMJBvY0QomBMyIM4Wpp8aamvN0rcsyQEGkDOV/h2i5/ID7Tkg+En3 JYNnOQv4XyZtCSH4QRt8uEixa+XO0x3CYaEc8iY90QBSpPY7WJYLJnYKRBjyMmIEC7+4 drGob4UV+CSOsxiJbW6r7TqUqzvzAPsAmSjRMSzqq95fpVQWN4D0qZRGcuRB6gUl+fsl AbiQ== X-Gm-Message-State: AOAM530UBq4EV6boLKPF6gwh7xHu83LcP/A8mkbHFptAn9yr5snfE4cy 0wliECbbVa1xt+VkvyUZUfkhcdX2T/wkmdcgi3CuYw== X-Received: by 2002:a17:906:1c84:: with SMTP id g4mr21577614ejh.155.1605019931251; Tue, 10 Nov 2020 06:52:11 -0800 (PST) MIME-Version: 1.0 References: <20201110123406.3261-1-brgl@bgdev.pl> <20201110123406.3261-7-brgl@bgdev.pl> <20201110142624.GT4077@smile.fi.intel.com> <20201110142750.GU4077@smile.fi.intel.com> In-Reply-To: From: Bartosz Golaszewski Date: Tue, 10 Nov 2020 15:52:00 +0100 Message-ID: Subject: Re: [PATCH v3 6/7] gpio: exar: switch to using regmap To: Jan Kiszka Cc: Andy Shevchenko , Bartosz Golaszewski , Linus Walleij , David Laight , linux-gpio , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 3:50 PM Jan Kiszka wrote: > > > On 10.11.20 15:30, Bartosz Golaszewski wrote: > > On Tue, Nov 10, 2020 at 3:26 PM Andy Shevchenko > > wrote: > >> > >> On Tue, Nov 10, 2020 at 04:26:24PM +0200, Andy Shevchenko wrote: > >>> On Tue, Nov 10, 2020 at 01:34:05PM +0100, Bartosz Golaszewski wrote: > >>>> From: Bartosz Golaszewski > >>>> > >>>> We can simplify the code in gpio-exar by using regmap. This allows us to > >>>> drop the mutex (regmap provides its own locking) and we can also reuse > >>>> regmap's bit operations instead of implementing our own update function. > >>> > >>> ... > >>> > >>>> + /* > >>>> + * We don't need to check the return values of mmio regmap operations (unless > >>>> + * the regmap has a clock attached which is not the case here). > >>>> + */ > >>>> + exar_gpio->regs = devm_regmap_init_mmio(dev, p, &exar_regmap_config); > >>>> + if (IS_ERR(exar_gpio->regs)) > >>>> + return PTR_ERR(exar_gpio->regs); > >>>> > >>>> index = ida_alloc(&ida_index, GFP_KERNEL); > >>>> - if (index < 0) { > >>>> - ret = index; > >>>> - goto err_mutex_destroy; > >>>> - } > >>>> + if (index < 0) > >>>> + return index; > >>> > >>> And below you effectively use p as regmap! > >>> That's what renaming of variable regs -> regmap or map can easily reveal. > >>> > >>> exar_gpio->regs = p; > >> > >> Jan, if you remove this line, does it help? > >> > > > > Ha! I guess you were right saying that keeping the name is asking for > > trouble then. :) > > > > I think that may be it but address width should still be changed to 16. > > > > Removing the line that Andy found made things work here. And switching > to 16 for reg_bits didn't make things worse again. > > Jan Alright! I'll send a v4 with these things fixed then. Bartosz