[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79878ad4-1c2a-39fa-5baa-042140a6f1ad@codeaurora.org>
Date: Mon, 1 Oct 2018 08:27:39 -0600
From: Jeffrey Hugo <jhugo@...eaurora.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
Linus Walleij <linus.walleij@...aro.org>
Cc: Timur Tabi <timur@...nel.org>, Stephen Boyd <swboyd@...omium.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-gpio <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning
On 10/1/2018 7:36 AM, Ricardo Ribalda Delgado wrote:
> Hi Linus
> On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.walleij@...aro.org> wrote:
>>
>> On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado
>> <ricardo.ribalda@...il.com> wrote:
>>
>>> How do we proceed from here? Can you fix your driver somehow to
>>> init the valid mask before enabling the gpio?
>>
>> Just include a hunk to the qcom driver reordering this call
>> at the same time. No need to make it separate patches,
>> it need to be tested together anyways.
>>
>> I guess just switch the order of these two:
>>
>> ret = gpiochip_add_data(&pctrl->chip, pctrl);
>> if (ret) {
>> dev_err(pctrl->dev, "Failed register gpiochip\n");
>> return ret;
>> }
>>
>> ret = msm_gpio_init_valid_mask(chip, pctrl);
>> if (ret) {
>> dev_err(pctrl->dev, "Failed to setup irq valid bits\n");
>> gpiochip_remove(&pctrl->chip);
>> return ret;
>> }
>>
>
> the problem is that valid_mask is not a long/integer, is a struct that
> needs to be malloced, and is malloc at gpiochip_add_data :(
>
> Maybe we need a callback from the driver to init that mask just after
> the allocation?
>
> A fast grep shows that the only driver using need_valid_mask (not for
> irq) is msm:
>
> ricardo@...pili:~/curro/kernel-upstream$ git grep "need_valid_mask ="
> | grep -v irq
> drivers/gpio/gpiolib.c: gpiochip->need_valid_mask = true;
> drivers/pinctrl/intel/pinctrl-cherryview.c: bool need_valid_mask =
> !dmi_check_system(chv_no_valid_mask);
> drivers/pinctrl/qcom/pinctrl-msm.c: chip->need_valid_mask =
> msm_gpio_needs_valid_mask(pctrl);
>
> so hacking something in the driver might not be a terrible idea.
>
IMO, hack up the driver and I'll test it. We can figure out what is
needed to work, then determine what is the proper solution for that.
--
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists