From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77F1AC388F7 for ; Tue, 10 Nov 2020 14:50:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A5B6206B2 for ; Tue, 10 Nov 2020 14:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730968AbgKJOud (ORCPT ); Tue, 10 Nov 2020 09:50:33 -0500 Received: from david.siemens.de ([192.35.17.14]:55844 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730200AbgKJOuc (ORCPT ); Tue, 10 Nov 2020 09:50:32 -0500 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id 0AAEoEXS011180 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Nov 2020 15:50:14 +0100 Received: from [167.87.33.169] ([167.87.33.169]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 0AAEoCko001593; Tue, 10 Nov 2020 15:50:12 +0100 Subject: Re: [PATCH v3 6/7] gpio: exar: switch to using regmap To: Bartosz Golaszewski , Andy Shevchenko Cc: Bartosz Golaszewski , Linus Walleij , David Laight , linux-gpio , LKML 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> From: Jan Kiszka Message-ID: Date: Tue, 10 Nov 2020 15:50:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux