2022-01-05 22:07:07

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

Add a symbol namespace for functions exported by the plaform chromeos
subsystem.
Add depenencies for all drivers using these function.

'make nsdeps' is used to fix the dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>

Gwendal Grignou (17):
plaform: chrome: Add PL_CHROMEOS export symbol namespace
iio:cros_ec_sensors: Add PL_CHROMEOS dependency
platform/chrome: Add PL_CHROMEOS dependency
power_supply: chromeos: Add PL_CHROMEOS dependency
rtc: wilco: Add PL_CHROMEOS dependency
mfd: cros_ec_dev: Add PL_CHROMEOS dependency
platform: chrome: Add PL_CHROMEOS dependency
rtc: cros_ec: Add PL_CHROMEOS dependency
extcon: cros_ec: Add PL_CHROMEOS dependency
HID: google: Add PL_CHROMEOS dependency
i2c: cros-ec-tunnel: Add PL_CHROMEOS dependency
Input: cros_ec_keyb - Add PL_CHROMEOS dependency
media: cros-ec-cec: Add PL_CHROMEOS dependency
power: supply: PCHG: Add PL_CHROMEOS dependency
pwm: cros-ec: Add PL_CHROMEOS dependency
regulator: cros-ec-regulator: Add PL_CHROMEOS dependency
ASoC: cros_ec_codec: Add PL_CHROMEOS dependency

drivers/extcon/extcon-usbc-cros-ec.c | 1 +
drivers/hid/hid-google-hammer.c | 1 +
drivers/i2c/busses/i2c-cros-ec-tunnel.c | 1 +
.../cros_ec_sensors/cros_ec_sensors_core.c | 1 +
drivers/iio/proximity/cros_ec_mkbp_proximity.c | 1 +
drivers/input/keyboard/cros_ec_keyb.c | 1 +
.../media/cec/platform/cros-ec/cros-ec-cec.c | 1 +
drivers/mfd/cros_ec_dev.c | 1 +
drivers/platform/chrome/cros_ec.c | 1 +
drivers/platform/chrome/cros_ec_chardev.c | 1 +
drivers/platform/chrome/cros_ec_debugfs.c | 1 +
drivers/platform/chrome/cros_ec_i2c.c | 1 +
drivers/platform/chrome/cros_ec_ishtp.c | 1 +
drivers/platform/chrome/cros_ec_lightbar.c | 1 +
drivers/platform/chrome/cros_ec_lpc.c | 1 +
drivers/platform/chrome/cros_ec_proto.c | 18 +++++++++---------
drivers/platform/chrome/cros_ec_rpmsg.c | 1 +
drivers/platform/chrome/cros_ec_sensorhub.c | 1 +
.../platform/chrome/cros_ec_sensorhub_ring.c | 4 ++--
drivers/platform/chrome/cros_ec_spi.c | 1 +
drivers/platform/chrome/cros_ec_sysfs.c | 1 +
drivers/platform/chrome/cros_ec_typec.c | 1 +
drivers/platform/chrome/cros_ec_vbc.c | 1 +
drivers/platform/chrome/cros_usbpd_logger.c | 1 +
drivers/platform/chrome/cros_usbpd_notify.c | 5 +++--
drivers/platform/chrome/wilco_ec/debugfs.c | 1 +
drivers/platform/chrome/wilco_ec/mailbox.c | 2 +-
drivers/platform/chrome/wilco_ec/properties.c | 8 ++++----
drivers/platform/chrome/wilco_ec/telemetry.c | 1 +
drivers/power/supply/cros_peripheral_charger.c | 1 +
drivers/power/supply/cros_usbpd-charger.c | 1 +
drivers/power/supply/wilco-charger.c | 1 +
drivers/pwm/pwm-cros-ec.c | 1 +
drivers/regulator/cros-ec-regulator.c | 1 +
drivers/rtc/rtc-cros-ec.c | 1 +
drivers/rtc/rtc-wilco-ec.c | 1 +
sound/soc/codecs/cros_ec_codec.c | 1 +
37 files changed, 51 insertions(+), 18 deletions(-)

--
2.34.1.448.ga2b2bfdf31-goog



2022-01-05 22:07:14

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 01/17] plaform: chrome: Add PL_CHROMEOS export symbol namespace

Add PL_CHROMEOS to hold functions exposed by the platform chromeos
subsystem:

for i in EXPORT_SYMBOL_GPL EXPORT_SYMBOL; do
sed -i "s/$i(\([^)]*\)/$i_NS(\1, PL_CHROMEOS/"
$(grep -lr $i drivers/platform/chrome/)
done

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/platform/chrome/cros_ec_proto.c | 18 +++++++++---------
.../platform/chrome/cros_ec_sensorhub_ring.c | 4 ++--
drivers/platform/chrome/cros_usbpd_notify.c | 4 ++--
drivers/platform/chrome/wilco_ec/mailbox.c | 2 +-
drivers/platform/chrome/wilco_ec/properties.c | 8 ++++----
5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index c4caf2e2de825f..2cfd7d97f6d737 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -189,7 +189,7 @@ int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,

return EC_MSG_TX_PROTO_BYTES + msg->outsize;
}
-EXPORT_SYMBOL(cros_ec_prepare_tx);
+EXPORT_SYMBOL_NS(cros_ec_prepare_tx, PL_CHROMEOS);

/**
* cros_ec_check_result() - Check ec_msg->result.
@@ -217,7 +217,7 @@ int cros_ec_check_result(struct cros_ec_device *ec_dev,
return 0;
}
}
-EXPORT_SYMBOL(cros_ec_check_result);
+EXPORT_SYMBOL_NS(cros_ec_check_result, PL_CHROMEOS);

/*
* cros_ec_get_host_event_wake_mask
@@ -557,7 +557,7 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
kfree(proto_msg);
return ret;
}
-EXPORT_SYMBOL(cros_ec_query_all);
+EXPORT_SYMBOL_NS(cros_ec_query_all, PL_CHROMEOS);

/**
* cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC.
@@ -625,7 +625,7 @@ int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,

return ret;
}
-EXPORT_SYMBOL(cros_ec_cmd_xfer_status);
+EXPORT_SYMBOL_NS(cros_ec_cmd_xfer_status, PL_CHROMEOS);

static int get_next_event_xfer(struct cros_ec_device *ec_dev,
struct cros_ec_command *msg,
@@ -767,7 +767,7 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev,

return ret;
}
-EXPORT_SYMBOL(cros_ec_get_next_event);
+EXPORT_SYMBOL_NS(cros_ec_get_next_event, PL_CHROMEOS);

/**
* cros_ec_get_host_event() - Return a mask of event set by the ChromeOS EC.
@@ -797,7 +797,7 @@ u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev)

return host_event;
}
-EXPORT_SYMBOL(cros_ec_get_host_event);
+EXPORT_SYMBOL_NS(cros_ec_get_host_event, PL_CHROMEOS);

/**
* cros_ec_check_features() - Test for the presence of EC features
@@ -830,7 +830,7 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature)

return !!(features->flags[feature / 32] & EC_FEATURE_MASK_0(feature));
}
-EXPORT_SYMBOL_GPL(cros_ec_check_features);
+EXPORT_SYMBOL_NS_GPL(cros_ec_check_features, PL_CHROMEOS);

/**
* cros_ec_get_sensor_count() - Return the number of MEMS sensors supported.
@@ -896,7 +896,7 @@ int cros_ec_get_sensor_count(struct cros_ec_dev *ec)
}
return sensor_count;
}
-EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
+EXPORT_SYMBOL_NS_GPL(cros_ec_get_sensor_count, PL_CHROMEOS);

/**
* cros_ec_command - Send a command to the EC.
@@ -944,4 +944,4 @@ int cros_ec_command(struct cros_ec_device *ec_dev,
kfree(msg);
return ret;
}
-EXPORT_SYMBOL_GPL(cros_ec_command);
+EXPORT_SYMBOL_NS_GPL(cros_ec_command, PL_CHROMEOS);
diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
index 98e37080f76091..fa6292e49a93e4 100644
--- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c
+++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
@@ -86,7 +86,7 @@ int cros_ec_sensorhub_register_push_data(struct cros_ec_sensorhub *sensorhub,

return 0;
}
-EXPORT_SYMBOL_GPL(cros_ec_sensorhub_register_push_data);
+EXPORT_SYMBOL_NS_GPL(cros_ec_sensorhub_register_push_data, PL_CHROMEOS);

void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub,
u8 sensor_num)
@@ -94,7 +94,7 @@ void cros_ec_sensorhub_unregister_push_data(struct cros_ec_sensorhub *sensorhub,
sensorhub->push_data[sensor_num].indio_dev = NULL;
sensorhub->push_data[sensor_num].push_data_cb = NULL;
}
-EXPORT_SYMBOL_GPL(cros_ec_sensorhub_unregister_push_data);
+EXPORT_SYMBOL_NS_GPL(cros_ec_sensorhub_unregister_push_data, PL_CHROMEOS);

/**
* cros_ec_sensorhub_ring_fifo_enable() - Enable or disable interrupt generation
diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
index 91ce6be91aac16..3a5a14b8175347 100644
--- a/drivers/platform/chrome/cros_usbpd_notify.c
+++ b/drivers/platform/chrome/cros_usbpd_notify.c
@@ -38,7 +38,7 @@ int cros_usbpd_register_notify(struct notifier_block *nb)
return blocking_notifier_chain_register(&cros_usbpd_notifier_list,
nb);
}
-EXPORT_SYMBOL_GPL(cros_usbpd_register_notify);
+EXPORT_SYMBOL_NS_GPL(cros_usbpd_register_notify, PL_CHROMEOS);

/**
* cros_usbpd_unregister_notify - Unregister notifier callback for PD events.
@@ -51,7 +51,7 @@ void cros_usbpd_unregister_notify(struct notifier_block *nb)
{
blocking_notifier_chain_unregister(&cros_usbpd_notifier_list, nb);
}
-EXPORT_SYMBOL_GPL(cros_usbpd_unregister_notify);
+EXPORT_SYMBOL_NS_GPL(cros_usbpd_unregister_notify, PL_CHROMEOS);

static void cros_usbpd_get_event_and_notify(struct device *dev,
struct cros_ec_device *ec_dev)
diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c
index 0f98358ea824c6..edbe90a68d53c7 100644
--- a/drivers/platform/chrome/wilco_ec/mailbox.c
+++ b/drivers/platform/chrome/wilco_ec/mailbox.c
@@ -212,4 +212,4 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
return ret;

}
-EXPORT_SYMBOL_GPL(wilco_ec_mailbox);
+EXPORT_SYMBOL_NS_GPL(wilco_ec_mailbox, PL_CHROMEOS);
diff --git a/drivers/platform/chrome/wilco_ec/properties.c b/drivers/platform/chrome/wilco_ec/properties.c
index c2bf4c95c5d2c9..011daac4de2f66 100644
--- a/drivers/platform/chrome/wilco_ec/properties.c
+++ b/drivers/platform/chrome/wilco_ec/properties.c
@@ -76,7 +76,7 @@ int wilco_ec_get_property(struct wilco_ec_device *ec,

return 0;
}
-EXPORT_SYMBOL_GPL(wilco_ec_get_property);
+EXPORT_SYMBOL_NS_GPL(wilco_ec_get_property, PL_CHROMEOS);

int wilco_ec_set_property(struct wilco_ec_device *ec,
struct wilco_ec_property_msg *prop_msg)
@@ -99,7 +99,7 @@ int wilco_ec_set_property(struct wilco_ec_device *ec,

return 0;
}
-EXPORT_SYMBOL_GPL(wilco_ec_set_property);
+EXPORT_SYMBOL_NS_GPL(wilco_ec_set_property, PL_CHROMEOS);

int wilco_ec_get_byte_property(struct wilco_ec_device *ec, u32 property_id,
u8 *val)
@@ -119,7 +119,7 @@ int wilco_ec_get_byte_property(struct wilco_ec_device *ec, u32 property_id,

return 0;
}
-EXPORT_SYMBOL_GPL(wilco_ec_get_byte_property);
+EXPORT_SYMBOL_NS_GPL(wilco_ec_get_byte_property, PL_CHROMEOS);

int wilco_ec_set_byte_property(struct wilco_ec_device *ec, u32 property_id,
u8 val)
@@ -132,4 +132,4 @@ int wilco_ec_set_byte_property(struct wilco_ec_device *ec, u32 property_id,

return wilco_ec_set_property(ec, &msg);
}
-EXPORT_SYMBOL_GPL(wilco_ec_set_byte_property);
+EXPORT_SYMBOL_NS_GPL(wilco_ec_set_byte_property, PL_CHROMEOS);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:18

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 02/17] iio:cros_ec_sensors: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 1 +
drivers/iio/proximity/cros_ec_mkbp_proximity.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
index b2725c6adc7f1f..be3aab8d881625 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
@@ -851,3 +851,4 @@ EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops);

MODULE_DESCRIPTION("ChromeOS EC sensor hub core functions");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
index 8213b00817132d..221d2e416326ea 100644
--- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
+++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
@@ -268,4 +268,5 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = {
module_platform_driver(cros_ec_mkbp_proximity_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC MKBP proximity sensor driver");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:25

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 03/17] platform/chrome: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/platform/chrome/cros_ec_sensorhub.c | 1 +
drivers/platform/chrome/cros_ec_typec.c | 1 +
drivers/platform/chrome/cros_usbpd_notify.c | 1 +
drivers/platform/chrome/wilco_ec/debugfs.c | 1 +
drivers/platform/chrome/wilco_ec/telemetry.c | 1 +
5 files changed, 5 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c
index 31fb8bdaad5a35..b469e19a296a74 100644
--- a/drivers/platform/chrome/cros_ec_sensorhub.c
+++ b/drivers/platform/chrome/cros_ec_sensorhub.c
@@ -261,3 +261,4 @@ MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Gwendal Grignou <[email protected]>");
MODULE_DESCRIPTION("ChromeOS EC MEMS Sensor Hub Driver");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 5de0bfb0bc4d99..1db7aabeb9b4b5 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -1167,3 +1167,4 @@ module_platform_driver(cros_typec_driver);
MODULE_AUTHOR("Prashant Malani <[email protected]>");
MODULE_DESCRIPTION("Chrome OS EC Type C control");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
index 3a5a14b8175347..28c5f7b50e0e22 100644
--- a/drivers/platform/chrome/cros_usbpd_notify.c
+++ b/drivers/platform/chrome/cros_usbpd_notify.c
@@ -256,6 +256,7 @@ module_init(cros_usbpd_notify_init);
module_exit(cros_usbpd_notify_exit);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS power delivery notifier device");
MODULE_AUTHOR("Jon Flatley <[email protected]>");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers/platform/chrome/wilco_ec/debugfs.c
index a812788a0bdcc2..7b9869bba0fb4b 100644
--- a/drivers/platform/chrome/wilco_ec/debugfs.c
+++ b/drivers/platform/chrome/wilco_ec/debugfs.c
@@ -282,4 +282,5 @@ module_platform_driver(wilco_ec_debugfs_driver);
MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Nick Crews <[email protected]>");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Wilco EC debugfs driver");
diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c
index 60da7a29f2ff2d..ebcc4e4628997f 100644
--- a/drivers/platform/chrome/wilco_ec/telemetry.c
+++ b/drivers/platform/chrome/wilco_ec/telemetry.c
@@ -469,4 +469,5 @@ module_exit(telem_module_exit);
MODULE_AUTHOR("Nick Crews <[email protected]>");
MODULE_DESCRIPTION("Wilco EC telemetry driver");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_ALIAS("platform:" DRV_NAME);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:27

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 04/17] power_supply: chromeos: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/power/supply/cros_usbpd-charger.c | 1 +
drivers/power/supply/wilco-charger.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c
index d89e08efd2ad0f..fdedcea010f637 100644
--- a/drivers/power/supply/cros_usbpd-charger.c
+++ b/drivers/power/supply/cros_usbpd-charger.c
@@ -722,5 +722,6 @@ static struct platform_driver cros_usbpd_charger_driver = {
module_platform_driver(cros_usbpd_charger_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC USBPD charger");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/power/supply/wilco-charger.c b/drivers/power/supply/wilco-charger.c
index 98ade073ef05fe..aeacdbf0b5df80 100644
--- a/drivers/power/supply/wilco-charger.c
+++ b/drivers/power/supply/wilco-charger.c
@@ -189,4 +189,5 @@ module_platform_driver(wilco_charge_driver);
MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Nick Crews <[email protected]>");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Wilco EC charge control driver");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:29

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 05/17] rtc: wilco: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/rtc/rtc-wilco-ec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c
index 2a205a64645213..82f6e707bb0af0 100644
--- a/drivers/rtc/rtc-wilco-ec.c
+++ b/drivers/rtc/rtc-wilco-ec.c
@@ -191,4 +191,5 @@ module_platform_driver(wilco_ec_rtc_driver);
MODULE_ALIAS("platform:rtc-wilco-ec");
MODULE_AUTHOR("Nick Crews <[email protected]>");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Wilco EC RTC driver");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:32

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 06/17] mfd: cros_ec_dev: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/mfd/cros_ec_dev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 546feef851abb5..9f501f8f30a5a2 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -330,3 +330,4 @@ MODULE_AUTHOR("Bill Richardson <[email protected]>");
MODULE_DESCRIPTION("Userspace interface to the Chrome OS Embedded Controller");
MODULE_VERSION("1.0");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:44

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 07/17] platform: chrome: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/platform/chrome/cros_ec.c | 1 +
drivers/platform/chrome/cros_ec_chardev.c | 1 +
drivers/platform/chrome/cros_ec_debugfs.c | 1 +
drivers/platform/chrome/cros_ec_i2c.c | 1 +
drivers/platform/chrome/cros_ec_ishtp.c | 1 +
drivers/platform/chrome/cros_ec_lightbar.c | 1 +
drivers/platform/chrome/cros_ec_lpc.c | 1 +
drivers/platform/chrome/cros_ec_rpmsg.c | 1 +
drivers/platform/chrome/cros_ec_spi.c | 1 +
drivers/platform/chrome/cros_ec_sysfs.c | 1 +
drivers/platform/chrome/cros_ec_vbc.c | 1 +
drivers/platform/chrome/cros_usbpd_logger.c | 1 +
12 files changed, 12 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
index fc5aa1525d13ca..9ca6759bfce587 100644
--- a/drivers/platform/chrome/cros_ec.c
+++ b/drivers/platform/chrome/cros_ec.c
@@ -398,4 +398,5 @@ EXPORT_SYMBOL(cros_ec_resume);
#endif

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC core driver");
diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
index e0bce869c49a92..666b291c3338ee 100644
--- a/drivers/platform/chrome/cros_ec_chardev.c
+++ b/drivers/platform/chrome/cros_ec_chardev.c
@@ -416,3 +416,4 @@ MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Enric Balletbo i Serra <[email protected]>");
MODULE_DESCRIPTION("ChromeOS EC Miscellaneous Character Driver");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 272c89837d745a..21b0f915eaca46 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -526,5 +526,6 @@ static struct platform_driver cros_ec_debugfs_driver = {
module_platform_driver(cros_ec_debugfs_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Debug logs for ChromeOS EC");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/platform/chrome/cros_ec_i2c.c b/drivers/platform/chrome/cros_ec_i2c.c
index 30c8938c27d54e..7a1227058e5c13 100644
--- a/drivers/platform/chrome/cros_ec_i2c.c
+++ b/drivers/platform/chrome/cros_ec_i2c.c
@@ -373,4 +373,5 @@ static struct i2c_driver cros_ec_driver = {
module_i2c_driver(cros_ec_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("I2C interface for ChromeOS Embedded Controller");
diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
index 4020b8354bae90..3ba619cfae8f75 100644
--- a/drivers/platform/chrome/cros_ec_ishtp.c
+++ b/drivers/platform/chrome/cros_ec_ishtp.c
@@ -794,3 +794,4 @@ MODULE_DESCRIPTION("ChromeOS EC ISHTP Client Driver");
MODULE_AUTHOR("Rushikesh S Kadam <[email protected]>");

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 469dfc7a4a0302..578a73bc9e2bb7 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -609,5 +609,6 @@ static struct platform_driver cros_ec_lightbar_driver = {
module_platform_driver(cros_ec_lightbar_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Expose the Chromebook Pixel's lightbar to userspace");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index d6306d2a096f13..016970479de80e 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -597,4 +597,5 @@ module_init(cros_ec_lpc_init);
module_exit(cros_ec_lpc_exit);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC LPC driver");
diff --git a/drivers/platform/chrome/cros_ec_rpmsg.c b/drivers/platform/chrome/cros_ec_rpmsg.c
index d96d15b8ca946d..87c087c557413f 100644
--- a/drivers/platform/chrome/cros_ec_rpmsg.c
+++ b/drivers/platform/chrome/cros_ec_rpmsg.c
@@ -304,4 +304,5 @@ static struct rpmsg_driver cros_ec_driver_rpmsg = {
module_rpmsg_driver(cros_ec_driver_rpmsg);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC multi function device (rpmsg)");
diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index 14c4046fa04d52..88771bda2bf3be 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -838,4 +838,5 @@ static struct spi_driver cros_ec_driver_spi = {
module_spi_driver(cros_ec_driver_spi);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("SPI interface for ChromeOS Embedded Controller");
diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
index f07eabcf9494cd..bf5be8f3db129e 100644
--- a/drivers/platform/chrome/cros_ec_sysfs.c
+++ b/drivers/platform/chrome/cros_ec_sysfs.c
@@ -368,5 +368,6 @@ static struct platform_driver cros_ec_sysfs_driver = {
module_platform_driver(cros_ec_sysfs_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Expose the ChromeOS EC through sysfs");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c
index c859c862d7ac55..ea98b708e34f85 100644
--- a/drivers/platform/chrome/cros_ec_vbc.c
+++ b/drivers/platform/chrome/cros_ec_vbc.c
@@ -142,5 +142,6 @@ static struct platform_driver cros_ec_vbc_driver = {
module_platform_driver(cros_ec_vbc_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Expose the vboot context nvram to userspace");
MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c
index d16931203d8216..d322da22940b59 100644
--- a/drivers/platform/chrome/cros_usbpd_logger.c
+++ b/drivers/platform/chrome/cros_usbpd_logger.c
@@ -263,5 +263,6 @@ static struct platform_driver cros_usbpd_logger_driver = {
module_platform_driver(cros_usbpd_logger_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("Logging driver for ChromeOS EC USBPD Charger.");
MODULE_ALIAS("platform:" DRV_NAME);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:07:55

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 08/17] rtc: cros_ec: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/rtc/rtc-cros-ec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c
index 70626793ca6941..696fffdd8d6dd7 100644
--- a/drivers/rtc/rtc-cros-ec.c
+++ b/drivers/rtc/rtc-cros-ec.c
@@ -397,4 +397,5 @@ module_platform_driver(cros_ec_rtc_driver);
MODULE_DESCRIPTION("RTC driver for Chrome OS ECs");
MODULE_AUTHOR("Stephen Barber <[email protected]>");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_ALIAS("platform:" DRV_NAME);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:08:07

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 09/17] extcon: cros_ec: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/extcon/extcon-usbc-cros-ec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c
index 5290cc2d19d953..53f5a568d86716 100644
--- a/drivers/extcon/extcon-usbc-cros-ec.c
+++ b/drivers/extcon/extcon-usbc-cros-ec.c
@@ -540,3 +540,4 @@ module_platform_driver(extcon_cros_ec_driver);
MODULE_DESCRIPTION("ChromeOS Embedded Controller extcon driver");
MODULE_AUTHOR("Benson Leung <[email protected]>");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:08:34

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 10/17] HID: google: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/hid/hid-google-hammer.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index 0403beb3104b9e..b5d3fa1097a97d 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -640,3 +640,4 @@ static void __exit hammer_exit(void)
module_exit(hammer_exit);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:08:46

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 11/17] i2c: cros-ec-tunnel: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/i2c/busses/i2c-cros-ec-tunnel.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
index 790ea3fda693b4..05a4eeae362100 100644
--- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
+++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
@@ -317,5 +317,6 @@ static struct platform_driver ec_i2c_tunnel_driver = {
module_platform_driver(ec_i2c_tunnel_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("EC I2C tunnel driver");
MODULE_ALIAS("platform:cros-ec-i2c-tunnel");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:08:53

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 12/17] Input: cros_ec_keyb - Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/input/keyboard/cros_ec_keyb.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index fc02c540636e72..b8c54c411822cf 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -741,5 +741,6 @@ static struct platform_driver cros_ec_keyb_driver = {
module_platform_driver(cros_ec_keyb_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC keyboard driver");
MODULE_ALIAS("platform:cros-ec-keyb");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:09:08

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 13/17] media: cros-ec-cec: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
index 2d95e16cd24893..273af1688c4cda 100644
--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
+++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
@@ -352,4 +352,5 @@ module_platform_driver(cros_ec_cec_driver);
MODULE_DESCRIPTION("CEC driver for ChromeOS ECs");
MODULE_AUTHOR("Neil Armstrong <[email protected]>");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_ALIAS("platform:" DRV_NAME);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:10:32

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 14/17] power: supply: PCHG: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/power/supply/cros_peripheral_charger.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/power/supply/cros_peripheral_charger.c b/drivers/power/supply/cros_peripheral_charger.c
index 305f10dfc06d1b..cb0d63c9a2bd80 100644
--- a/drivers/power/supply/cros_peripheral_charger.c
+++ b/drivers/power/supply/cros_peripheral_charger.c
@@ -382,5 +382,6 @@ static struct platform_driver cros_pchg_driver = {
module_platform_driver(cros_pchg_driver);

MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC peripheral device charger");
MODULE_ALIAS("platform:" DRV_NAME);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:10:41

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 15/17] pwm: cros-ec: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/pwm/pwm-cros-ec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-cros-ec.c b/drivers/pwm/pwm-cros-ec.c
index 5e29d9c682c34f..c180c5bab2a4b0 100644
--- a/drivers/pwm/pwm-cros-ec.c
+++ b/drivers/pwm/pwm-cros-ec.c
@@ -306,3 +306,4 @@ module_platform_driver(cros_ec_pwm_driver);
MODULE_ALIAS("platform:cros-ec-pwm");
MODULE_DESCRIPTION("ChromeOS EC PWM driver");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:10:43

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 16/17] regulator: cros-ec-regulator: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
drivers/regulator/cros-ec-regulator.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/cros-ec-regulator.c b/drivers/regulator/cros-ec-regulator.c
index c4754f3cf23377..4bdd6a90700831 100644
--- a/drivers/regulator/cros-ec-regulator.c
+++ b/drivers/regulator/cros-ec-regulator.c
@@ -252,5 +252,6 @@ static struct platform_driver cros_ec_regulator_driver = {
module_platform_driver(cros_ec_regulator_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC controlled regulator");
MODULE_AUTHOR("Pi-Hsun Shih <[email protected]>");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:10:46

by Gwendal Grignou

[permalink] [raw]
Subject: [PATCH 17/17] ASoC: cros_ec_codec: Add PL_CHROMEOS dependency

Use 'make nsdeps' to add missing dependencies.

Signed-off-by: Gwendal Grignou <[email protected]>
---
sound/soc/codecs/cros_ec_codec.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
index 9b92e1a0d1a3a7..8d8fb8403fb80a 100644
--- a/sound/soc/codecs/cros_ec_codec.c
+++ b/sound/soc/codecs/cros_ec_codec.c
@@ -1062,6 +1062,7 @@ static struct platform_driver cros_ec_codec_platform_driver = {
module_platform_driver(cros_ec_codec_platform_driver);

MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PL_CHROMEOS);
MODULE_DESCRIPTION("ChromeOS EC codec driver");
MODULE_AUTHOR("Cheng-Yi Chiang <[email protected]>");
MODULE_ALIAS("platform:cros-ec-codec");
--
2.34.1.448.ga2b2bfdf31-goog


2022-01-05 22:50:50

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

Hi Gwendal,

On Wed, Jan 5, 2022 at 2:07 PM Gwendal Grignou <[email protected]> wrote:
>
> Add a symbol namespace for functions exported by the plaform chromeos
> subsystem.

It would be great to explain why this is needed/desirable. What are
the benefits of introducing this namespace? What problem are you
trying to solve?

> Add depenencies for all drivers using these function.
>
> 'make nsdeps' is used to fix the dependencies.
>
> Signed-off-by: Gwendal Grignou <[email protected]>
>
> Gwendal Grignou (17):
> plaform: chrome: Add PL_CHROMEOS export symbol namespace
> iio:cros_ec_sensors: Add PL_CHROMEOS dependency

I wonder if ordering patches this way breaks compilation (patches
should be structured in such a way that one need not apply entire
series to get to buildable kernel). Isn't putting symbols into new
namespace makes them unavailable to modules unless they explicitly
import it?

Thanks.

--
Dmitry

2022-01-06 04:26:52

by Gwendal Grignou

[permalink] [raw]
Subject: Re: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

On Wed, Jan 5, 2022 at 2:58 PM Dmitry Torokhov <[email protected]> wrote:
>
> Hi Gwendal,
>
> On Wed, Jan 5, 2022 at 2:07 PM Gwendal Grignou <[email protected]> wrote:
> >
> > Add a symbol namespace for functions exported by the plaform chromeos
> > subsystem.
>
> It would be great to explain why this is needed/desirable. What are
> the benefits of introducing this namespace? What problem are you
> trying to solve?
The issue came when reviewing an iio sensor
(https://www.spinics.net/lists/linux-iio/msg66280.html). I wanted to
be ahead of the curve (for once).

>
> > Add depenencies for all drivers using these function.
> >
> > 'make nsdeps' is used to fix the dependencies.
> >
> > Signed-off-by: Gwendal Grignou <[email protected]>
> >
> > Gwendal Grignou (17):
> > plaform: chrome: Add PL_CHROMEOS export symbol namespace
> > iio:cros_ec_sensors: Add PL_CHROMEOS dependency
>
> I wonder if ordering patches this way breaks compilation (patches
> should be structured in such a way that one need not apply entire
> series to get to buildable kernel). Isn't putting symbols into new
> namespace makes them unavailable to modules unless they explicitly
> import it?
From https://www.kernel.org/doc/html/latest/core-api/symbol-namespaces.html#loading-modules-that-use-namespaced-symbols,
since MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is set by default, this
is just a warning at load time.

Gwendal.
>
> Thanks.
>
> --
> Dmitry

2022-01-06 10:06:09

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

Em Wed, 5 Jan 2022 20:26:36 -0800
Gwendal Grignou <[email protected]> escreveu:

> On Wed, Jan 5, 2022 at 2:58 PM Dmitry Torokhov <[email protected]> wrote:
> >
> > Hi Gwendal,
> >
> > On Wed, Jan 5, 2022 at 2:07 PM Gwendal Grignou <[email protected]> wrote:
> > >
> > > Add a symbol namespace for functions exported by the plaform chromeos
> > > subsystem.
> >
> > It would be great to explain why this is needed/desirable. What are
> > the benefits of introducing this namespace? What problem are you
> > trying to solve?
> The issue came when reviewing an iio sensor
> (https://www.spinics.net/lists/linux-iio/msg66280.html). I wanted to
> be ahead of the curve (for once).

Patch 01 should clearly document the reason why this is needed.
Yet, see below.

While I see value on using namespaces, we should have extra care when
this is used for kAPIs designed for a product/system. I mean, what
prevents that the affected drivers won't support some day different
non-ChromeOS products? We have a media driver originally written to
work with the One Laptop Per Children hardware, that used some
product-specific kAPIs, that were extended a couple years later to
cover different types of hardware.

What happens if some day, a driver introduced to be used on a ChromeOS
hardware would also be used by a non-ChromeOS hardware? This could
become messy as times goes by.

Instead, IMO, it would make sense to have per-subsystem namespaces.
So, for instance, placing iio under an IIO-specific namespace
(and the same for other subsystems) makes more sense on my
eyes, as the namespace boundary will be clearer, and an IIO driver
will always be IIO, no matter on what hardware such driver would
be used.

Thanks,
Mauro

2022-01-10 09:32:05

by Gwendal Grignou

[permalink] [raw]
Subject: Re: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

On Thu, Jan 6, 2022 at 2:06 AM Mauro Carvalho Chehab <[email protected]> wrote:
>
> Em Wed, 5 Jan 2022 20:26:36 -0800
> Gwendal Grignou <[email protected]> escreveu:
>
> > On Wed, Jan 5, 2022 at 2:58 PM Dmitry Torokhov <[email protected]> wrote:
> > >
> > > Hi Gwendal,
> > >
> > > On Wed, Jan 5, 2022 at 2:07 PM Gwendal Grignou <[email protected]> wrote:
> > > >
> > > > Add a symbol namespace for functions exported by the plaform chromeos
> > > > subsystem.
> > >
> > > It would be great to explain why this is needed/desirable. What are
> > > the benefits of introducing this namespace? What problem are you
> > > trying to solve?
> > The issue came when reviewing an iio sensor
> > (https://www.spinics.net/lists/linux-iio/msg66280.html). I wanted to
> > be ahead of the curve (for once).
>
> Patch 01 should clearly document the reason why this is needed.
> Yet, see below.
>
> While I see value on using namespaces, we should have extra care when
> this is used for kAPIs designed for a product/system. I mean, what
> prevents that the affected drivers won't support some day different
> non-ChromeOS products? We have a media driver originally written to
> work with the One Laptop Per Children hardware, that used some
> product-specific kAPIs, that were extended a couple years later to
> cover different types of hardware.
>
> What happens if some day, a driver introduced to be used on a ChromeOS
> hardware would also be used by a non-ChromeOS hardware? This could
> become messy as times goes by.
>
> Instead, IMO, it would make sense to have per-subsystem namespaces.
> So, for instance, placing iio under an IIO-specific namespace
> (and the same for other subsystems) makes more sense on my
> eyes, as the namespace boundary will be clearer, and an IIO driver
> will always be IIO, no matter on what hardware such driver would
> be used.
I based this patchset on the current/future use in the IIO subsystem,
where the namespaces are used for small subsystem like HID,
IIO_HID_ATTRIBUTES, or code shared among sensors drivers of the same
vendor (LTC2497, more to come).
Since the usage of namespace in the kernel is not clearly defined yet,
I wait for the dust to settle and more usage to emerge before tuning
this patchset.

Thanks,
Gwendal.
>
> Thanks,
> Mauro

2022-01-17 09:30:21

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 00/17] Add export symbol namespace PL_CHROMEOS

On Mon, 10 Jan 2022 01:31:23 -0800
Gwendal Grignou <[email protected]> wrote:

> On Thu, Jan 6, 2022 at 2:06 AM Mauro Carvalho Chehab <[email protected]> wrote:
> >
> > Em Wed, 5 Jan 2022 20:26:36 -0800
> > Gwendal Grignou <[email protected]> escreveu:
> >
> > > On Wed, Jan 5, 2022 at 2:58 PM Dmitry Torokhov <[email protected]> wrote:
> > > >
> > > > Hi Gwendal,
> > > >
> > > > On Wed, Jan 5, 2022 at 2:07 PM Gwendal Grignou <[email protected]> wrote:
> > > > >
> > > > > Add a symbol namespace for functions exported by the plaform chromeos
> > > > > subsystem.
> > > >
> > > > It would be great to explain why this is needed/desirable. What are
> > > > the benefits of introducing this namespace? What problem are you
> > > > trying to solve?
> > > The issue came when reviewing an iio sensor
> > > (https://www.spinics.net/lists/linux-iio/msg66280.html). I wanted to
> > > be ahead of the curve (for once).
> >
> > Patch 01 should clearly document the reason why this is needed.
> > Yet, see below.
> >
> > While I see value on using namespaces, we should have extra care when
> > this is used for kAPIs designed for a product/system. I mean, what
> > prevents that the affected drivers won't support some day different
> > non-ChromeOS products? We have a media driver originally written to
> > work with the One Laptop Per Children hardware, that used some
> > product-specific kAPIs, that were extended a couple years later to
> > cover different types of hardware.
> >
> > What happens if some day, a driver introduced to be used on a ChromeOS
> > hardware would also be used by a non-ChromeOS hardware? This could
> > become messy as times goes by.
Hi Mauro,

I'm not sure I see why this case is a problem or any worse than the
namespacing that already exists in the function names. We name a lot
of stuff after first device that used it and some of it lives for ever.
Sure, sometime it makes sense to rename when something becomes more
generic, but we can do that here as needed.

> >
> > Instead, IMO, it would make sense to have per-subsystem namespaces.
> > So, for instance, placing iio under an IIO-specific namespace
> > (and the same for other subsystems) makes more sense on my
> > eyes, as the namespace boundary will be clearer, and an IIO driver
> > will always be IIO, no matter on what hardware such driver would
> > be used.
> I based this patchset on the current/future use in the IIO subsystem,
> where the namespaces are used for small subsystem like HID,
> IIO_HID_ATTRIBUTES, or code shared among sensors drivers of the same
> vendor (LTC2497, more to come).

Not particularly intended to be vendor based, more library module and client
of library cases. Obviously it's relatively rare for multiple vendors
to produce IIO devices that are sufficiently compatible to share code
beyond the IIO core, but it does happen. In that particular case the
library is called LTC2497 as it was the first part to use it it and
there wasn't a sensible generic name. Vast majority of IIO cases will
be a core module exporting stuff to i2c and spi specific modules.

We have drivers named after a particular part that support parts from
multiple vendors of many different names. So in a similar fashion
I'm not that worried about having some future driver have to include
one of the namespaces that is named after some other part. Perhaps
the issue here is that the chromeos platform stuff has a name tightly
coupled to a somewhat 'generic' but also somewhat closed hardware
ecosystem?

(Not really relevant here but I do longer term plan to move the main
IIO core into a namespace, but focusing on the smaller cases first as
I think both are valid).

So I'm in support of this series but maybe you are right in waiting for
the dust to settle :) Note I'd also like to see an IIO_CHROMEOS or
similar NS for the symbols exported by cros_ec_sensors_core.c.

Eventually I'd expect some of the IIO chromeos modules to have
MODULE_IMPORT_NS(IIO);
MODULE_IMPORT_NS(IIO_CHROMEOS);
MODULE_IMPORT_NS(PL_CHROMEOS);

and probably some others...

Jonathan

> Since the usage of namespace in the kernel is not clearly defined yet,
> I wait for the dust to settle and more usage to emerge before tuning
> this patchset.
>
> Thanks,
> Gwendal.
> >
> > Thanks,
> > Mauro