From: Shree Ramamoorthy <s-ramamoorthy@ti.com>
To: Andrew Davis <afd@ti.com>, Roger Quadros <rogerq@kernel.org>,
<lgirdwood@gmail.com>, <broonie@kernel.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<aaro.koskinen@iki.fi>, <andreas@kemnade.info>,
<khilman@baylibre.com>, <tony@atomide.com>,
<jerome.neanne@baylibre.com>, <linux-omap@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Cc: <m-leonard@ti.com>, <praneeth@ti.com>
Subject: Re: [PATCH v1 6/7] regulator: tps65215: Define probe() helper functions
Date: Tue, 7 Jan 2025 15:09:51 -0600 [thread overview]
Message-ID: <0746c757-e25a-4fa0-ba22-90ec123e87e6@ti.com> (raw)
In-Reply-To: <0f7f8b5d-728b-4f97-9100-5879eacb8c93@ti.com>
Hi,
On 1/6/25 4:57 PM, Andrew Davis wrote:
> On 1/6/25 4:02 PM, Shree Ramamoorthy wrote:
>> Hi,
>>
>> On 1/4/2025 12:45 PM, Roger Quadros wrote:
>>>
>>> On 26/12/2024 23:54, Shree Ramamoorthy wrote:
>>>> Factor register_regulators() and request_irqs() out into smaller
>>>> functions.
>>>> These 2 helper functions are used in the next restructure probe()
>>>> patch to
>>>> go through the common (overlapping) regulators and irqs first, then
>>>> the
>>>> device-specific structs identifed in the chip_data struct.
>>>>
>>>> Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com>
>>>> ---
>>>> drivers/regulator/tps65219-regulator.c | 64
>>>> ++++++++++++++++++++++++++
>>>> 1 file changed, 64 insertions(+)
>>>>
>>>> diff --git a/drivers/regulator/tps65219-regulator.c
>>>> b/drivers/regulator/tps65219-regulator.c
>>>> index 13f0e68d8e85..8469ee89802c 100644
>>>> --- a/drivers/regulator/tps65219-regulator.c
>>>> +++ b/drivers/regulator/tps65219-regulator.c
>>>> @@ -346,6 +346,70 @@ static struct chip_data chip_info_table[] = {
>>>> },
>>>> };
>>>> +static int tps65219_register_regulators(const struct
>>>> regulator_desc *regulators,
>>>> + struct tps65219 *tps,
>>>> + struct device *dev,
>>>> + struct regulator_config config,
>>>> + unsigned int arr_size)
>>>> +{
>>>> + int i;
>>>> + struct regulator_dev *rdev;
>>> reverse xmas tree?
>>
>> Applied reverse xmas tree style to this file & will review other
>> files as well for this.
>>
>>>> +
>>>> + config.driver_data = tps;
>>>> + config.dev = tps->dev;
>>>> + config.regmap = tps->regmap;
>>>> +
>>>> + for (i = 0; i < arr_size; i++) {
>>>> + rdev = devm_regulator_register(dev, ®ulators[i],
>>>> + &config);
>>>> + if (IS_ERR(rdev)) {
>>>> + dev_err(tps->dev,
>>>> + "Failed to register %s regulator\n",
>>>> + regulators[i].name);
>>>> +
>>>> + return PTR_ERR(rdev);
>>>> + }
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int tps65219_request_irqs(struct
>>>> tps65219_regulator_irq_type *irq_types,
>>>> + struct tps65219 *tps, struct platform_device *pdev,
>>>> + struct tps65219_regulator_irq_data *irq_data,
>>>> + unsigned int arr_size)
>>>> +{
>>>> + int i;
>>>> + int irq;
>>>> + int error;
>>>> + struct tps65219_regulator_irq_type *irq_type;
>>> here too.
>>>
>>>> +
>>>> + for (i = 0; i < arr_size; ++i) {
>>>> + irq_type = &irq_types[i];
>>>> +
>>> unnecessary new line.
>>>
>>>> + irq = platform_get_irq_byname(pdev, irq_type->irq_name);
>>>> + if (irq < 0)
>>>> + return -EINVAL;
>>>> +
>>>> + irq_data[i].dev = tps->dev;
>>>> + irq_data[i].type = irq_type;
>>>> +
>>> here too
>>
>> Removed both new lines.
>>
>>>> + error = devm_request_threaded_irq(tps->dev, irq, NULL,
>>>> + tps65219_regulator_irq_handler,
>>>> + IRQF_ONESHOT,
>>>> + irq_type->irq_name,
>>>> + &irq_data[i]);
>>>> + if (error) {
>>>> + dev_err(tps->dev,
>>>> + "Failed to request %s IRQ %d: %d\n",
>>>> + irq_type->irq_name, irq, error);
>>>> + return error;
>>>> + }
>>>> + }
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> static int tps65219_regulator_probe(struct platform_device *pdev)
>>>> {
>>>> struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
>>> This patch by itself will complain during build as there are no
>>> users for
>>> these functions.
>>> Could you please squash patches 6 and 7?
>>
>> I kept patch 6 and 7 separate as the diff was hard to read &
>> the git diff options did not resolve this. Is there a way to keep
>> these 2 patches
>> separate for user readability and avoid the build error? Or just
>> squash them to
>> prevent build errors knowing the diff will be hard to read? Thank you
>> for your help!
>>
>>
>
> Instead of splitting the adding and the using of the functions, could you
> split tps65219_register_regulators() and tps65219_request_irqs() into
> their
> own patches? Each patch should add and also make use of the added
> function.
>
> Andrew
I was able to split up the 2 helper functions & usage into their own patches. The diff is clean
except for a mistaken new function, but it's easy to read compared to squashing this patch with 7/7.
--
Best,
Shree Ramamoorthy
PMIC Software Engineer
next prev parent reply other threads:[~2025-01-07 21:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 21:54 [PATCH v1 0/7] Add TI TPS65215 PMIC Regulator Support Shree Ramamoorthy
2024-12-26 21:54 ` [PATCH v1 1/7] regulator: dt-bindings: Add TI TPS65215 PMIC bindings Shree Ramamoorthy
2024-12-27 17:45 ` Conor Dooley
2025-01-04 18:28 ` Roger Quadros
2024-12-26 21:54 ` [PATCH v1 2/7] regulator: tps65215: Update platform_device_id table Shree Ramamoorthy
2025-01-01 10:49 ` Christophe JAILLET
2024-12-26 21:54 ` [PATCH v1 3/7] regulator: tps65215: Update function & struct names Shree Ramamoorthy
2025-01-04 18:35 ` Roger Quadros
2024-12-26 21:54 ` [PATCH v1 4/7] regulator: tps65215: Update IRQ structs to include TPS65215 Shree Ramamoorthy
2024-12-26 21:54 ` [PATCH v1 5/7] regulator: tps65215: Add chip_data struct for multi-PMIC support Shree Ramamoorthy
2024-12-26 21:54 ` [PATCH v1 6/7] regulator: tps65215: Define probe() helper functions Shree Ramamoorthy
2025-01-01 11:01 ` Christophe JAILLET
2025-01-02 23:41 ` Shree Ramamoorthy
2025-01-03 13:10 ` Christophe JAILLET
2025-01-04 18:42 ` Roger Quadros
2025-01-04 18:45 ` Roger Quadros
2025-01-06 22:02 ` Shree Ramamoorthy
2025-01-06 22:57 ` Andrew Davis
2025-01-07 21:09 ` Shree Ramamoorthy [this message]
2024-12-26 21:54 ` [PATCH v1 7/7] regulator: tps65215: Restructure probe() for multi-PMIC support Shree Ramamoorthy
2025-01-01 11:04 ` Christophe JAILLET
2025-01-02 23:46 ` Shree Ramamoorthy
2025-01-04 18:47 ` Roger Quadros
2025-01-07 21:12 ` Shree Ramamoorthy
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=0746c757-e25a-4fa0-ba22-90ec123e87e6@ti.com \
--to=s-ramamoorthy@ti.com \
--cc=aaro.koskinen@iki.fi \
--cc=afd@ti.com \
--cc=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jerome.neanne@baylibre.com \
--cc=khilman@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=m-leonard@ti.com \
--cc=praneeth@ti.com \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=tony@atomide.com \
/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