linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	thierry.reding@gmail.com, Stephen Boyd <sboyd@codeaurora.org>,
	david.brown@linaro.org, andy.gross@linaro.org,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Varadarajan Narayanan <varada@codeaurora.org>,
	Archit Taneja <architt@codeaurora.org>
Subject: Re: [PATCH 2/4] [v2] gpiolib: add bitmask for valid GPIO lines
Date: Tue, 12 Dec 2017 14:16:54 -0600	[thread overview]
Message-ID: <80f8ed45-4b74-b132-26c0-ecf6a0c4ccda@codeaurora.org> (raw)
In-Reply-To: <1513072725.25007.614.camel@linux.intel.com>

On 12/12/2017 03:58 AM, Andy Shevchenko wrote:
> On Fri, 2017-12-01 at 17:28 -0600, Timur Tabi wrote:
>> Add support for specifying that some GPIOs within a range are
>> unavailable.
>> Some systems have a sparse list of GPIOs, where a range of GPIOs is
>> specified (usually 0 to n-1), but some subset within that range is
>> absent or unavailable for whatever reason.
>>
>> To support this, allow drivers to specify a bitmask of GPIOs that
>> are present or absent.  Gpiolib will then block access to those that
>> are absent.
>   
>> -	status = gpiochip_irqchip_init_valid_mask(chip);
>> +	status = gpiochip_init_valid_mask(chip);
>>   	if (status)
>>   		goto err_remove_from_list;
>>   
>> +	status = gpiochip_irqchip_init_valid_mask(chip);
>> +	if (status)
>> +		goto err_remove_valid_mask;
> 
> Yes, this way it looks good!

I've discovered that I can remove all this code.  I don't need a valid 
mask, all I need to do is block the request properly.

>> +static bool gpiochip_available(const struct gpio_chip *gpiochip,
>> +			   unsigned int offset)
>> +{
> 
>> +	pr_info("%s:%u offset=%u\n", __func__, __LINE__, offset);
> 
> Debug leftover?

Fixed, thanks.

> 
>> +
>> +	/* No mask means all valid */
>> +	if (likely(!gpiochip->valid_mask))
>> +		return true;
>> +
>> +	return test_bit(offset, gpiochip->valid_mask);
> 
> Not sure which one is better
>   return test_bit();
> or
>   return !!test_bit();

I've removed this function also.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-12-12 20:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 23:28 [PATCH 0/4] [v8] pinctrl: qcom: add support for sparse GPIOs Timur Tabi
2017-12-01 23:28 ` [PATCH 1/4] [v2] Revert "gpio: set up initial state from .get_direction()" Timur Tabi
2017-12-01 23:28 ` [PATCH 2/4] [v2] gpiolib: add bitmask for valid GPIO lines Timur Tabi
2017-12-12  9:58   ` Andy Shevchenko
2017-12-12 20:16     ` Timur Tabi [this message]
2017-12-01 23:28 ` [PATCH 3/4] [v7] pinctrl: qcom: disable GPIO groups with no pins Timur Tabi
2017-12-01 23:28 ` [PATCH 4/4] [v4] pinctrl: qcom: qdf2xxx: add support for new ACPI HID QCOM8002 Timur Tabi
2017-12-12 10:05   ` Andy Shevchenko
2017-12-12 20:17     ` Timur Tabi
2017-12-13 14:32       ` Andy Shevchenko
2017-12-13 14:46         ` Timur Tabi
2017-12-13 15:18           ` Timur Tabi
2017-12-13 15:40             ` Andy Shevchenko
     [not found]   ` <1512170904-4749-5-git-send-email-timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-12-12 10:42     ` Linus Walleij
2017-12-12 11:07       ` Andy Shevchenko
2017-12-12 20:27         ` Timur Tabi
2017-12-13 14:36           ` Andy Shevchenko
2017-12-13 14:47             ` Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80f8ed45-4b74-b132-26c0-ecf6a0c4ccda@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.gross@linaro.org \
    --cc=architt@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=david.brown@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sboyd@codeaurora.org \
    --cc=thierry.reding@gmail.com \
    --cc=varada@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).