All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	satya priya <skakit@codeaurora.org>
Cc: David Collins <collinsd@codeaurora.org>,
	kgunda@codeaurora.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	satya priya <skakit@codeaurora.org>
Subject: Re: [PATCH V2 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation
Date: Fri, 03 Sep 2021 11:09:24 -0700	[thread overview]
Message-ID: <163069256450.405991.2176328404036039930@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <1630574106-3394-2-git-send-email-skakit@codeaurora.org>

Quoting satya priya (2021-09-02 02:15:05)
> diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> index 98bf0e2..dbae168 100644
> --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  /*
> - * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
> + * Copyright (c) 2012-2014, 2016-2021 The Linux Foundation. All rights reserved.
>   */
>  
>  #include <linux/gpio/driver.h>
> @@ -14,6 +14,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/slab.h>
> +#include <linux/spmi.h>
>  #include <linux/types.h>
>  
>  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
> @@ -171,6 +172,8 @@ struct pmic_gpio_state {
>         struct pinctrl_dev *ctrl;
>         struct gpio_chip chip;
>         struct irq_chip irq;
> +       u8 usid;
> +       u8 pid_base;
>  };
>  
>  static const struct pinconf_generic_params pmic_gpio_bindings[] = {
> @@ -949,12 +952,36 @@ static int pmic_gpio_child_to_parent_hwirq(struct gpio_chip *chip,
>                                            unsigned int *parent_hwirq,
>                                            unsigned int *parent_type)
>  {
> -       *parent_hwirq = child_hwirq + 0xc0;
> +       struct pmic_gpio_state *state = gpiochip_get_data(chip);
> +
> +       *parent_hwirq = child_hwirq + state->pid_base;
>         *parent_type = child_type;
>  
>         return 0;
>  }
>  
> +static void *pmic_gpio_populate_parent_fwspec(struct gpio_chip *chip,
> +                                            unsigned int parent_hwirq,
> +                                            unsigned int parent_type)
> +{
> +       struct pmic_gpio_state *state = gpiochip_get_data(chip);
> +       struct irq_fwspec *fwspec;
> +
> +       fwspec = kzalloc(sizeof(*fwspec), GFP_KERNEL);

The implementation of gpiochip_populate_parent_fwspec_fourcell() uses
kmalloc() here. Should we also do that? Presumably the fwspec will be
set with the important parts so this will save a memset call.

> +       if (!fwspec)
> +               return NULL;
> +
> +       fwspec->fwnode = chip->irq.parent_domain->fwnode;
> +
> +       fwspec->param_count = 4;
> +       fwspec->param[0] = state->usid;
> +       fwspec->param[1] = parent_hwirq;
> +       fwspec->param[2] = 0;

If the kzalloc stays, this can be dropped.

> +       fwspec->param[3] = parent_type;
> +
> +       return fwspec;
> +}
> +
>  static int pmic_gpio_probe(struct platform_device *pdev)
>  {
>         struct irq_domain *parent_domain;

  reply	other threads:[~2021-09-03 18:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  9:15 [PATCH V2 0/2] Add Vol+ support for sc7280-idp satya priya
2021-09-02  9:15 ` [PATCH V2 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation satya priya
2021-09-03 18:09   ` Stephen Boyd [this message]
2021-09-02  9:15 ` [PATCH V2 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp satya priya
2021-09-03 18:12   ` Stephen Boyd
2021-09-06 10:58     ` skakit
2021-09-08  7:28 [PATCH V2 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation skakit

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=163069256450.405991.2176328404036039930@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kgunda@codeaurora.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=skakit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.