Skip to contentSkip to conversation

Add of match tables for the ChromeOs EC subdevices

PATCH Superseded Sjoerd Simons 3 participants 7 messages Aug 22, 2014 – Aug 25, 2014

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add of match tables for the ChromeOs EC subdevices

The ChromeOS EC MFD driver registers its sub-devices with both a (platform) name and an of compatibility string. As a result of this the modalias passed on to user-space will be based on the of compatibility string. Thus to be able to rely on autoloading in case the subdevices are build as modules they need to export the necessary module aliases based to match the of information.

The two patches in these series add the requird of match information to the EC subdevices

Sjoerd Simons (2):
i2c: cros-ec-tunnel: Add of match table
input: cros_ec_keyb: Add of match table

 drivers/i2c/busses/i2c-cros-ec-tunnel.c |  9 +++++++++
 drivers/input/keyboard/cros_ec_keyb.c   | 10 ++++++++++
 2 files changed, 19 insertions(+)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 i2c: cros-ec-tunnel: Add of match table

To enable the cros-ec-tunnel driver to be auto-loaded when build as a module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string.

---
 drivers/i2c/busses/i2c-cros-ec-tunnel.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/busses/i2c-cros-ec-tunnel.c +9 -0
index 05e033c..3c15dcc 100644
@@ -310,11 +310,20 @@ static int ec_i2c_remove(struct platform_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_i2c_of_match[] = {
+	{ .compatible = "google,cros-ec-i2c-tunnel" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
+#endif
+
 static struct platform_driver ec_i2c_tunnel_driver = {
 	.probe = ec_i2c_probe,
 	.remove = ec_i2c_remove,
 	.driver = {
 		.name = "cros-ec-i2c-tunnel",
+		.of_match_table = of_match_ptr (cros_ec_i2c_of_match),
 	},
 };
 
Signature · 1 line
2.1.0
#2 lore raw

PATCH 1/2 i2c: cros-ec-tunnel: Add of match table

Hello Sjoerd,

Quoted 7 lines · Sjoerd Simons

To enable the cros-ec-tunnel driver to be auto-loaded when build as a module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string.

---

Looks good to me:

Best regards,
Javier

#3 lore raw

PATCH 2/2 input: cros_ec_keyb: Add of match table

In reply to Sjoerd Simons

To enable the cros_ec_keyb driver to be auto-loaded when build as module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string.

---
 drivers/input/keyboard/cros_ec_keyb.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/input/keyboard/cros_ec_keyb.c +10 -0
index 791781a..0bdbf2d 100644
@@ -342,10 +342,20 @@ static int cros_ec_keyb_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
 
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_keyb_of_match[] = {
+	{ .compatible = "google,cros-ec-keyb" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
+#endif
+
+
 static struct platform_driver cros_ec_keyb_driver = {
 	.probe = cros_ec_keyb_probe,
 	.driver = {
 		.name = "cros-ec-keyb",
+		.of_match_table = of_match_ptr (cros_ec_keyb_of_match),
 		.pm	= &cros_ec_keyb_pm_ops,
 	},
 };
Signature · 1 line
2.1.0
#4 lore raw

PATCH 2/2 input: cros_ec_keyb: Add of match table

Hello.

Quoted 15 lines · Sjoerd Simons

To enable the cros_ec_keyb driver to be auto-loaded when build as module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string.

---
  drivers/input/keyboard/cros_ec_keyb.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/input/keyboard/cros_ec_keyb.c +0 -0
index 791781a..0bdbf2d 100644

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 346

Quoted 5 lines
drivers/input/keyboard/cros_ec_keyb.c +2 -0
@@ -342,10 +342,20 @@ static int cros_ec_keyb_resume(struct device *dev)
 
  static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
 
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_keyb_of_match[] = {

Perhaps better to use '__maybe_unused' instead of #ifdef...

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 353

Quoted 7 lines
drivers/input/keyboard/cros_ec_keyb.c +7 -0
+	{ .compatible = "google,cros-ec-keyb" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
+#endif
+
+

Too many empty lines.

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 358

Quoted 5 lines
drivers/input/keyboard/cros_ec_keyb.c +1 -0
  static struct platform_driver cros_ec_keyb_driver = {
  	.probe = cros_ec_keyb_probe,
  	.driver = {
  		.name = "cros-ec-keyb",
+		.of_match_table = of_match_ptr (cros_ec_keyb_of_match),

There shouldn't be space before (.

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 361

Quoted 3 lines
drivers/input/keyboard/cros_ec_keyb.c +0 -0
  		.pm	= &cros_ec_keyb_pm_ops,
  	},
  };

WBR, Sergei

#5 lore raw

PATCH 2/2 input: cros_ec_keyb: Add of match table

Hey,

Quoted 20 lines · Sergei Shtylyov

Hello.

Quoted 16 lines · Sjoerd Simons

To enable the cros_ec_keyb driver to be auto-loaded when build as module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string.

---
  drivers/input/keyboard/cros_ec_keyb.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/input/keyboard/cros_ec_keyb.c +0 -0
index 791781a..0bdbf2d 100644
@@ -342,10 +342,20 @@ static int cros_ec_keyb_resume(struct device *dev)
 
Quoted 6 lines

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 346

Quoted 4 lines
drivers/input/keyboard/cros_ec_keyb.c +2 -0
  static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
 
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_keyb_of_match[] = {

Perhaps better to use '__maybe_unused' instead of #ifdef...

Hmm, looks like the rtc-ds1742.c driver is the only one in the kernel tree using that strategy, while all others use #ifdef CONFIG_OF. So i'm inclined to keep the #ifdef here, ooi what is your rationale behind suggesting __maybe_unused?

Quoted 12 lines

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 353

Quoted 7 lines
drivers/input/keyboard/cros_ec_keyb.c +7 -0
+	{ .compatible = "google,cros-ec-keyb" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
+#endif
+
+

Too many empty lines.

Quoted 7 lines

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 358

Quoted 5 lines
drivers/input/keyboard/cros_ec_keyb.c +1 -0
  static struct platform_driver cros_ec_keyb_driver = {
  	.probe = cros_ec_keyb_probe,
  	.driver = {
  		.name = "cros-ec-keyb",
+		.of_match_table = of_match_ptr (cros_ec_keyb_of_match),

There shouldn't be space before (.

Will fix the identation issues in a v2.

Thanks for the review,
Sjoerd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140825/9ab07e2c/attachment.bin>

#6 lore raw

PATCH 2/2 input: cros_ec_keyb: Add of match table

Hello,

Quoted 8 lines · Sjoerd Simons
Quoted 7 lines

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 346

Quoted 5 lines
  static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);
drivers/input/keyboard/cros_ec_keyb.c +2 -0
+#ifdef CONFIG_OF
+static const struct of_device_id cros_ec_keyb_of_match[] = {

Perhaps better to use '__maybe_unused' instead of #ifdef...

Quoted 5 lines

Hmm, looks like the rtc-ds1742.c driver is the only one in the kernel tree using that strategy, while all others use #ifdef CONFIG_OF. So i'm inclined to keep the #ifdef here, ooi what is your rationale behind suggesting __maybe_unused?

I agree with Sjoerd on this. Not only using the #ifdef guards makes it more evident when reading the code that this depends on OF being enabled but also if using __maybe_unused an entry in the struct of_device_id table will be added for no reason.

Quoted 19 lines
Quoted 19 lines

drivers/input/keyboard/cros_ec_keyb.c static int cros_ec_keyb_resume(struct device *dev) · line 353

Quoted 8 lines
drivers/input/keyboard/cros_ec_keyb.c +7 -0
+   { .compatible = "google,cros-ec-keyb" },
+   {},
+};
+MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
+#endif
+
+

Too many empty lines.

Quoted 5 lines
  static struct platform_driver cros_ec_keyb_driver = {
    .probe = cros_ec_keyb_probe,
    .driver = {
            .name = "cros-ec-keyb",

+ .of_match_table = of_match_ptr (cros_ec_keyb_of_match),

Quoted 6 lines
Quoted 1 line

There shouldn't be space before (.

Will fix the identation issues in a v2.

Thanks for the review,
Sjoerd

After fixing the empty lines:

Best regards,
Javier