public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
To: netdev@vger•kernel.org, linux-kernel@vger•kernel.org
Cc: Richard Cochran <richardcochran@gmail•com>,
	Jonathan Lemon <jonathan.lemon@gmail•com>,
	Vadim Fedorenko <vadim.fedorenko@linux•dev>,
	Andrew Lunn <andrew+netdev@lunn•ch>,
	"David S. Miller" <davem@davemloft•net>,
	Eric Dumazet <edumazet@google•com>,
	Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
	Andy Shevchenko <andriy.shevchenko@linux•intel.com>
Subject: [PATCH net-next v1 3/7] ptp: ocp: Refactor ptp_ocp_i2c_notifier_call()
Date: Tue, 11 Nov 2025 17:52:10 +0100	[thread overview]
Message-ID: <20251111165232.1198222-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20251111165232.1198222-1-andriy.shevchenko@linux.intel.com>

Refactor ptp_ocp_i2c_notifier_call() to avoid unneeded local variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
---
 drivers/ptp/ptp_ocp.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 28243fb1d78f..1dbbca4197bc 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4872,16 +4872,6 @@ ptp_ocp_i2c_notifier_call(struct notifier_block *nb,
 {
 	struct device *dev, *child = data;
 	struct ptp_ocp *bp;
-	bool add;
-
-	switch (action) {
-	case BUS_NOTIFY_ADD_DEVICE:
-	case BUS_NOTIFY_DEL_DEVICE:
-		add = action == BUS_NOTIFY_ADD_DEVICE;
-		break;
-	default:
-		return 0;
-	}
 
 	if (!i2c_verify_adapter(child))
 		return 0;
@@ -4894,10 +4884,17 @@ ptp_ocp_i2c_notifier_call(struct notifier_block *nb,
 
 found:
 	bp = dev_get_drvdata(dev);
-	if (add)
+
+	switch (action) {
+	case BUS_NOTIFY_ADD_DEVICE:
 		ptp_ocp_symlink(bp, child, "i2c");
-	else
+		break;
+	case BUS_NOTIFY_DEL_DEVICE:
 		sysfs_remove_link(&bp->dev.kobj, "i2c");
+		break;
+	default:
+		return 0;
+	}
 
 	return 0;
 }
-- 
2.50.1


  parent reply	other threads:[~2025-11-11 16:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 16:52 [PATCH v1 0/7] ptp: ocp: A fix and refactoring Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 1/7] ptp: ocp: Refactor signal_show() and fix %ptT misuse Andy Shevchenko
2025-11-12 13:29   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 2/7] ptp: ocp: Make ptp_ocp_unregister_ext() NULL-aware Andy Shevchenko
2025-11-12 13:38   ` Vadim Fedorenko
2025-11-11 16:52 ` Andy Shevchenko [this message]
2025-11-12 13:45   ` [PATCH net-next v1 3/7] ptp: ocp: Refactor ptp_ocp_i2c_notifier_call() Vadim Fedorenko
2025-11-12 15:04     ` Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 4/7] ptp: ocp: Apply standard pattern for cleaning up loop Andy Shevchenko
2025-11-12 13:36   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 5/7] ptp: ocp: Reuse META's PCI vendor ID Andy Shevchenko
2025-11-12 13:37   ` Vadim Fedorenko
2025-11-11 16:52 ` [PATCH net-next v1 6/7] ptp: ocp: Sort headers alphabetically Andy Shevchenko
2025-11-11 16:52 ` [PATCH net-next v1 7/7] ptp: ocp: don't use "proxy" headers Andy Shevchenko
2025-11-12 15:27 ` [PATCH v1 0/7] ptp: ocp: A fix and refactoring Vadim Fedorenko

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=20251111165232.1198222-4-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux$(echo .)intel.com \
    --cc=andrew+netdev@lunn$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=jonathan.lemon@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=richardcochran@gmail$(echo .)com \
    --cc=vadim.fedorenko@linux$(echo .)dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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