public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Abdurrahman Hussain via B4 Relay
	<devnull+abdurrahman.nexthop.ai@kernel.org>
Cc: <abdurrahman@nexthop.ai>, Michal Simek <michal.simek@amd.com>,
	Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v7 2/6] i2c: xiic: switch to devres managed APIs
Date: Fri, 30 Jan 2026 10:48:32 +0000	[thread overview]
Message-ID: <20260130104832.00005890@huawei.com> (raw)
In-Reply-To: <20260129-i2c-xiic-v7-2-727e434897ef@nexthop.ai>

On Thu, 29 Jan 2026 21:43:14 +0000
Abdurrahman Hussain via B4 Relay <devnull+abdurrahman.nexthop.ai@kernel.org> wrote:

> From: Abdurrahman Hussain <abdurrahman@nexthop.ai>
> 
> Simplify the error code paths by switching to devres managed helper
> functions.
> 
> Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
> ---
>  drivers/i2c/busses/i2c-xiic.c | 28 +++++++++++-----------------
>  1 file changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 912a94d4d080..a480cbb86d93 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -1462,7 +1462,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	snprintf(i2c->adap.name, sizeof(i2c->adap.name),
>  		 DRIVER_NAME " %s", pdev->name);
>  
> -	mutex_init(&i2c->lock);
> +	ret = devm_mutex_init(dev, &i2c->lock);
> +	if (ret)
> +		return ret;
> +
>  	spin_lock_init(&i2c->atomic_lock);
>  
>  	if (is_of_node(dev->fwnode)) {
> @@ -1475,8 +1478,9 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	i2c->dev = &pdev->dev;
>  	pm_runtime_set_autosuspend_delay(i2c->dev, XIIC_PM_TIMEOUT);
>  	pm_runtime_use_autosuspend(i2c->dev);
> -	pm_runtime_set_active(i2c->dev);
> -	pm_runtime_enable(i2c->dev);
> +	ret = devm_pm_runtime_set_active_enabled(dev);
> +	if (ret)
> +		return ret;
>  
>  	/* SCL frequency configuration */
>  	i2c->input_clk = clk_get_rate(i2c->clk);
> @@ -1492,7 +1496,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  
>  	if (ret < 0) {
>  		dev_err_probe(&pdev->dev, ret, "Cannot claim IRQ\n");
> -		goto err_pm_disable;
> +		return ret;

		return dev_err_probe();

>  	}
>  
>  	i2c->singlemaster =
> @@ -1511,16 +1515,14 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  		i2c->endianness = BIG;
>  
>  	ret = xiic_reinit(i2c);
> -	if (ret < 0) {
> -		dev_err_probe(&pdev->dev, ret, "Cannot xiic_reinit\n");
> -		goto err_pm_disable;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Cannot xiic_reinit\n");
>  
>  	/* add i2c adapter to i2c tree */
>  	ret = i2c_add_adapter(&i2c->adap);
>  	if (ret) {
>  		xiic_deinit(i2c);
> -		goto err_pm_disable;
> +		return ret;
>  	}
>  
>  	if (pdata) {
> @@ -1532,12 +1534,6 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>  	dev_dbg(&pdev->dev, "mmio %08lx irq %d scl clock frequency %d\n",
>  		(unsigned long)res->start, irq, i2c->i2c_clk);
>  
> -	return 0;
> -
> -err_pm_disable:
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
> -
>  	return ret;
>  }
>  
> @@ -1558,8 +1554,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
>  		xiic_deinit(i2c);
>  
>  	pm_runtime_put_sync(i2c->dev);
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
>  	pm_runtime_dont_use_autosuspend(&pdev->dev);
>  }
>  
> 


  reply	other threads:[~2026-01-30 10:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 21:43 [PATCH v7 0/6] i2c: xiic: use generic device property accessors Abdurrahman Hussain via B4 Relay
2026-01-29 21:43 ` [PATCH v7 1/6] i2c: xiic: skip input clock setup on non-OF systems Abdurrahman Hussain via B4 Relay
2026-01-29 22:43   ` Andrew Lunn
2026-01-29 23:29     ` Abdurrahman Hussain
2026-01-31 10:12       ` Andy Shevchenko
2026-02-01  1:30         ` Abdurrahman Hussain
2026-02-02 13:21           ` Andrew Lunn
2026-02-02 18:26             ` Abdurrahman Hussain
2026-01-31 10:10   ` Andy Shevchenko
2026-01-29 21:43 ` [PATCH v7 2/6] i2c: xiic: switch to devres managed APIs Abdurrahman Hussain via B4 Relay
2026-01-30 10:48   ` Jonathan Cameron [this message]
2026-01-31 10:31   ` Andy Shevchenko
2026-01-29 21:43 ` [PATCH v7 3/6] i2c: xiic: remove duplicate error message Abdurrahman Hussain via B4 Relay
2026-01-30 10:49   ` Jonathan Cameron
2026-01-29 21:43 ` [PATCH v7 4/6] i2c: xiic: switch to generic device property accessors Abdurrahman Hussain via B4 Relay
2026-01-29 21:43 ` [PATCH v7 5/6] i2c: xiic: cosmetic cleanup Abdurrahman Hussain via B4 Relay
2026-01-31 14:35   ` Dan Carpenter
2026-02-01  2:14     ` Abdurrahman Hussain
2026-02-01 22:23       ` Uwe Kleine-König
2026-02-02  2:06         ` Abdurrahman Hussain
2026-01-29 21:43 ` [PATCH v7 6/6] i2c xiic: cosmetic: use resource format specifier in debug log Abdurrahman Hussain via B4 Relay
2026-01-31 10:55   ` Andy Shevchenko
2026-01-29 22:36 ` [PATCH v7 0/6] i2c: xiic: use generic device property accessors Andrew Lunn
2026-01-31 10:57   ` Andy Shevchenko

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=20260130104832.00005890@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=abdurrahman@nexthop.ai \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+abdurrahman.nexthop.ai@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=robh@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