From: Florian Fainelli <florian.fainelli@broadcom.com>
To: linux-kernel@vger.kernel.org
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,
Lee Jones <lee@kernel.org>, Jiawen Wu <jiawenwu@trustnetic.com>,
Mengyuan Lou <mengyuanlou@net-swift.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Andrew Lunn <andrew@lunn.ch>,
Duanqiang Wen <duanqiangwen@net-swift.com>,
linux-i2c@vger.kernel.org (open list:SYNOPSYS DESIGNWARE I2C
DRIVER),
netdev@vger.kernel.org (open list:WANGXUN ETHERNET DRIVER)
Subject: [PATCH v3 2/5] i2c: designware: Create shared header hosting driver name
Date: Thu, 25 Apr 2024 14:44:35 -0700 [thread overview]
Message-ID: <20240425214438.2100534-3-florian.fainelli@broadcom.com> (raw)
In-Reply-To: <20240425214438.2100534-1-florian.fainelli@broadcom.com>
We have a number of drivers that reference the string "i2c_designware"
towards two goals:
- ensure their device gets bound to the i2c_designware platform_driver
- create a clock lookup reference that matches the i2c_designware
instance number for the i2c-designware-platdrv.c driver to be able to
lookup the input reference clock
Since this string is copied in a bunch of different places and since it
is possible to get this named wrong (see [1] and [2]) with unintended
consequences, create a header file that hosts that define for other
drivers to use and all agree on the correct name to use.
Link: https://lore.kernel.org/all/20240422084109.3201-1-duanqiangwen@net-swift.com/ [1]
Link: https://lore.kernel.org/all/20240422084109.3201-2-duanqiangwen@net-swift.com/ [2]
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
MAINTAINERS | 1 +
drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++-
include/linux/platform_data/i2c-designware.h | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 include/linux/platform_data/i2c-designware.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 2d5acd6d98c4..da1b39df2b94 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21438,6 +21438,7 @@ R: Jan Dabros <jsd@semihalf.com>
L: linux-i2c@vger.kernel.org
S: Supported
F: drivers/i2c/busses/i2c-designware-*
+F: include/linux/platform_data/i2c-designware.h
SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
M: Jaehoon Chung <jh80.chung@samsung.com>
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0be7b0dc849b..107945d0337e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -33,6 +33,8 @@
#include <linux/suspend.h>
#include <linux/units.h>
+#include <linux/platform_data/i2c-designware.h>
+
#include "i2c-designware-core.h"
static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
@@ -489,7 +491,7 @@ static struct platform_driver dw_i2c_driver = {
.probe = dw_i2c_plat_probe,
.remove_new = dw_i2c_plat_remove,
.driver = {
- .name = "i2c_designware",
+ .name = I2C_DESIGNWARE_NAME,
.of_match_table = of_match_ptr(dw_i2c_of_match),
.acpi_match_table = ACPI_PTR(dw_i2c_acpi_match),
.pm = pm_ptr(&dw_i2c_dev_pm_ops),
diff --git a/include/linux/platform_data/i2c-designware.h b/include/linux/platform_data/i2c-designware.h
new file mode 100644
index 000000000000..1196103df4f5
--- /dev/null
+++ b/include/linux/platform_data/i2c-designware.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __I2C_DESIGNWARE_PDATA_H__
+#define __I2C_DESIGNWARE_PDATA_H__
+
+/*
+ * This is the i2c-designware-platdrv.c platform driver name. This name is used
+ * to bind the device to the driver as well as by the driver itself to request
+ * the input reference clock.
+ */
+#define I2C_DESIGNWARE_NAME "i2c_designware"
+
+#endif /* __I2C_DESIGNWARE_PDATA_H__ */
--
2.34.1
next prev parent reply other threads:[~2024-04-25 21:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 21:44 [PATCH v3 0/5] Define i2c_designware in a header file Florian Fainelli
2024-04-25 21:44 ` [PATCH v3 1/5] i2c: designware: Replace MODULE_ALIAS() with MODULE_DEVICE_TABLE() Florian Fainelli
2024-04-25 21:44 ` Florian Fainelli [this message]
2024-04-25 21:44 ` [PATCH v3 3/5] mfd: intel-lpss: Utilize i2c-designware.h Florian Fainelli
2024-04-25 21:44 ` [PATCH v3 4/5] mfd: intel_quark_i2c_gpio: " Florian Fainelli
2024-04-26 14:30 ` Andy Shevchenko
2024-04-30 9:36 ` Andi Shyti
2024-05-02 9:19 ` Jarkko Nikula
2024-05-02 10:11 ` Lee Jones
2024-05-02 16:08 ` Florian Fainelli
2024-04-25 21:44 ` [PATCH v3 5/5] net: txgbe: " Florian Fainelli
2024-05-02 23:09 ` (subset) [PATCH v3 0/5] Define i2c_designware in a header file Andi Shyti
2024-05-03 6:30 ` Jarkko Nikula
2024-05-03 15:38 ` Andy Shevchenko
2024-05-03 18:26 ` Andi Shyti
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=20240425214438.2100534-3-florian.fainelli@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=andi.shyti@kernel.org \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=duanqiangwen@net-swift.com \
--cc=edumazet@google.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jiawenwu@trustnetic.com \
--cc=jsd@semihalf.com \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=mengyuanlou@net-swift.com \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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