linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Courbot <gnurou@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Ning Li <ning.li@intel.com>,
	Alan Cox <alan@linux.intel.com>, Mark Brown <broonie@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 1/2] x86, gpio: Increase ARCH_NR_GPIOs to 512
Date: Sat, 20 Sep 2014 14:56:48 +0900	[thread overview]
Message-ID: <CAAVeFuL46SVb_X2is6yNSK30_FjUVw+Cbnm6B8q59PHN69ZA1w@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdYbmcxi=BXEyGzLpxN4omt+v_Cg_BxCiN4vS9ZUwYTLzQ@mail.gmail.com>

On Sat, Sep 20, 2014 at 2:48 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Sep 19, 2014 at 12:20 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
>> On Tue, Sep 9, 2014 at 4:24 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
>
>>> This however makes it *impossible* to use things like desc_to_gpio()
>>> and/or gpio_to_desc() so the code has to be augmented all over the
>>> place to avoid any uses of GPIO numbers on that architecture,
>>> but I am sure it *can* be done on pure ACPI or device tree
>>> systems, and that's what we should aim for.
>>
>> desc_to_gpio()/gpio_to_desc() could still work even if we remove the
>> big array of GPIO descriptors. Actually that's what I intended to do
>> when I first submitted the gpiod patches some time ago but it was
>> rejected for performance reasons.
>
> OK. I'm ready to revisit the subject.
>
>> desc_to_gpio() actually doesn't even access this array - it does its
>> job using the chip base and the beginning address of its descriptors
>> array.
>
> Right.
>
>> gpio_to_desc() would suffer a performance hit. What I initially
>> proposed was to parse the linked list of GPIO chips and check if the
>> requested number is in their assigned range. This is obviously slower
>> than accessing an array, but if we consider that we generally don't
>> have too many GPIO chips on a given hardware I don't think the hit
>> would be that bad. It would also give some incentive for people to
>> move to the gpiod interface.
>
> I think the performance hit is acceptable, because this should
> not be on a hot path anyway. I would say go ahead with this refactoring.

Great! I will come with something once my holidays are over. It should
not be a complex change.

>
>> I also have a patch in my queue that enables multiple users on the
>> same GPIO descriptor (something requested since some time already).
>> What happens with it is that descriptors ownership is fully
>> transferred to the gpio_chip instances, and the static array becomes a
>> array of double-pointers, making it considerable smaller and reducing
>> the impact of increasing its size. Maybe I should submit that change
>> just for this case?
>
> Ummmmm I think that is an orthogonal thing, but honestly I'm
> not following the double-pointers thing, so I guess I need to see
> the patch.

Yes, this is completely orthogonal, and actually this won't be needed
if we decide to get rid of that array.

      reply	other threads:[~2014-09-20  5:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 11:47 [PATCH 1/2] x86, gpio: Increase ARCH_NR_GPIOs to 512 Mika Westerberg
2014-09-08 11:48 ` [PATCH 2/2] gpio: Add support for Intel Cherryview/Braswell GPIO controller Mika Westerberg
2014-09-09  7:24 ` [PATCH 1/2] x86, gpio: Increase ARCH_NR_GPIOs to 512 Linus Walleij
2014-09-09  7:41   ` H. Peter Anvin
2014-09-09  9:46   ` Mika Westerberg
2014-09-19  7:20   ` Alexandre Courbot
2014-09-19 10:46     ` Mika Westerberg
2014-09-19 17:48     ` Linus Walleij
2014-09-20  5:56       ` Alexandre Courbot [this message]

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=CAAVeFuL46SVb_X2is6yNSK30_FjUVw+Cbnm6B8q59PHN69ZA1w@mail.gmail.com \
    --to=gnurou@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=broonie@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=ning.li@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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).