Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1425449pxb; Wed, 4 Nov 2020 08:35:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJy57hAtU5z9bFASbtpm3dYHgcO/fWxRgIeuJQsRNnnqlkMsA7AKAbW4229Wc5VSL+6oGdqc X-Received: by 2002:a17:906:ad85:: with SMTP id la5mr21669261ejb.423.1604507718159; Wed, 04 Nov 2020 08:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604507718; cv=none; d=google.com; s=arc-20160816; b=rYNLrrqphIZHq2aRMEmzDvIaKInQFpRnTINUoOlC7na3BchX8CgcAG4q+gA668GiK2 LRMm1H06WauS4584xx6kJHixnfwJIbV2leWW++Qs6OezsykA5v86/QAFcK69guWAnPWR fx+wPy/0ILdzHEz7Kq92L46gCxOzTRbpHwwGqpgKUg2rX9+bjFYCT1xGVw3I6OY7nb+6 DYFPlFwSBIv4qTABUMqDFqN3vx9IeCQFQvBGUyjoi+un5czoUkYE6+iJZ1N0Gkdo/t62 cczSHH1wrgcIvSWTNkJBUU81mFT1s1h0660g3KiIj0c6pk5gVqcAHC0aYR8SaDIZw+x0 7Xgg== 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=W89f9FhGl3ZmVVNh0IHsLhIBpTCURVceMfMaDhwTtHw=; b=0GIQCQ0QXOcE/EEtmVwNshOaInl8Vv7V8DI6URst7FUXIpe0ojNQWOOspouja49AB5 hJLIoA3gBOFJJRw41pxWAYytQ+z9/IrffmBF5xvP3Qu+IFhH8E4IKPvJIVdilpx5gQ0K 42QOAMRO9ncjgGaCh5bb9NOFYiZFBpr78zMT3kdBKnOHmMlB0CWFa//qTxLjN9MsgB6Y LqwxRjQrtAIWwK7LaNiGSZA4sJqvh/OYm5SwNPt//CG1AtSxYnJWGUpUI0yg+rn9u340 7VYvkcrk8vm7FdymVGQSYRft6SilT22jKbT9prFWxER3Xiq/LiIYn8PZmjb18LIhNxv6 bDZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=wOXbh51k; 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 d10si1916140edo.243.2020.11.04.08.34.53; Wed, 04 Nov 2020 08:35:18 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=wOXbh51k; 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 S1730873AbgKDQc6 (ORCPT + 99 others); Wed, 4 Nov 2020 11:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgKDQc6 (ORCPT ); Wed, 4 Nov 2020 11:32:58 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D44E7C0613D4 for ; Wed, 4 Nov 2020 08:32:57 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id m9so9142623iox.10 for ; Wed, 04 Nov 2020 08:32:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W89f9FhGl3ZmVVNh0IHsLhIBpTCURVceMfMaDhwTtHw=; b=wOXbh51kkIYJs16L1wH3zkeCtTYv8T3jVyI9PcksX4T2ZXuxqC5XvQwkRVBbymWcyG TYU5UXvAznrnKFiD+OFfz9pYVb7HHC3ZPM/DWvFTIt6TSN6dEuGo4JkCT1eI10I4TxGm fdN5ynsz/tQLW95cF1DdBCu/iV/HEMG4pwV4CcKwVe1+DYxQIJnZb63+MfhDX5n9Xt4J jd4K66pXpTidg9covNMepxicSh9d7ohLlI/UlvSDxmsI5XwbnVhcJsfXZSYc29zSLfI0 BsExRvy8tvEYvHhJldBW/hCWGxlOwl2cUai165/ViBT29XXai5mqfZ00DdKAlaU5auwY R4mA== 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=W89f9FhGl3ZmVVNh0IHsLhIBpTCURVceMfMaDhwTtHw=; b=pJRhP3ZwS7vPB6ubAONPXgkUYAxkAg1QC5pdSBgPuXh+thoaF2FNS0PeETVHhvq70Z L5HOa4+yjID8EnVOsw63jqOeCEbETIhkfRbdlCmmbBVjktef8YFFRQdfVAkJTLFRjQNn yI/WO67kJnAH2z4FxADz49tUttlmSBPjKFEbI058cCzJRPYaWqIOyUhldgFKtStxROWB +SO1CXbNYMcU4O9vYtgk3zs2eoZb+qpd7OIl94ozyhC0L0VIWjH57Q5lio1mu0X13hNg OQxhurArKQqTd5e+5zCuVHZwUiPtk3FW3bhRQ/8S/0xFYdGC2avZrnLtfYJOYwHxWAVW 1AZw== X-Gm-Message-State: AOAM531kvwRJqu5J+grCRwQB5/2jGH7MqAsFmVa09Zs/KXTekK7yusFp C8zL6olgmrWvbnEKHw5DMnPN3yzN0aGmeV5g2wIizw== X-Received: by 2002:a02:65cf:: with SMTP id u198mr20169169jab.24.1604507577178; Wed, 04 Nov 2020 08:32:57 -0800 (PST) MIME-Version: 1.0 References: <20201026141839.28536-1-brgl@bgdev.pl> <20201026141839.28536-7-brgl@bgdev.pl> In-Reply-To: <20201026141839.28536-7-brgl@bgdev.pl> From: Bartosz Golaszewski Date: Wed, 4 Nov 2020 17:32:46 +0100 Message-ID: Subject: Re: [RFT PATCH 6/7] gpio: exar: switch to using regmap To: Sudip Mukherjee , Linus Walleij Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 3:18 PM 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. > > Signed-off-by: Bartosz Golaszewski [snip] > > static int exar_direction_output(struct gpio_chip *chip, unsigned int offset, > int value) > { > - exar_set_value(chip, offset, value); > - return exar_set_direction(chip, 0, offset); > + struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip); > + unsigned int addr = exar_offset_to_sel_addr(exar_gpio, offset); > + unsigned int bit = exar_offset_to_bit(exar_gpio, offset); > + > + regmap_clear_bits(exar_gpio->regs, addr, BIT(bit)); > + > + return 0; > } > Upon closer look I noticed this now ignores the value argument. I doubt however it's the culprit of the crash Jan reported. [snip] Bartosz