History

platform/chrome: cros_ec: Match implementation with headers

The 'cros_ec' core driver is the common interface for the cros_ec transport drivers to do the shared operations to register, unregister, suspend, resume and handle_event. The interface is provided by including the header 'include/linux/platform_data/cros_ec_proto.h', however, instead of have the implementation of these functions in cros_ec_proto.c, it is in 'cros_ec.c', which is a different kernel module. Apart from being a bad practice, this can induce confusions allowing the users of the cros_ec protocol to call these functions. The register, unregister, suspend, resume and handle_event functions *should* only be called by the different transport drivers (i2c, spi, lpc, etc.), so make this a bit less confusing by moving these functions from the public in-kernel space to a private include in platform/chrome, and then, the interface for cros_ec module and for the cros_ec_proto module is clean.

Enric Balletbo i Serra committed 6 years ago

Commit 034dbec1 parent 943063b8 files · +30 −10Browse files

Showing the changes to include/linux (1 of 8 files). Show all

Unified · Split

include/linux/platform_data/cros_ec_proto.h+0−10
@@ -206,10 +206,6 @@ struct cros_ec_dev { · 205 unmodified lines
206 206
207#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)207#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)
208 208
209int cros_ec_suspend(struct cros_ec_device *ec_dev);
210
211int cros_ec_resume(struct cros_ec_device *ec_dev);
212
213int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,209int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
214 struct cros_ec_command *msg);210 struct cros_ec_command *msg);
215 211
@@ -222,10 +218,6 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, · 6 unmodified lines
222int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,218int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
223 struct cros_ec_command *msg);219 struct cros_ec_command *msg);
224 220
225int cros_ec_register(struct cros_ec_device *ec_dev);
226
227int cros_ec_unregister(struct cros_ec_device *ec_dev);
228
229int cros_ec_query_all(struct cros_ec_device *ec_dev);221int cros_ec_query_all(struct cros_ec_device *ec_dev);
230 222
231int cros_ec_get_next_event(struct cros_ec_device *ec_dev,223int cros_ec_get_next_event(struct cros_ec_device *ec_dev,
@@ -238,8 +230,6 @@ int cros_ec_check_features(struct cros_ec_dev *ec, int feature); · 6 unmodified lines
238 230
239int cros_ec_get_sensor_count(struct cros_ec_dev *ec);231int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
240 232
241bool cros_ec_handle_event(struct cros_ec_device *ec_dev);
242
243/**233/**
244 * cros_ec_get_time_ns() - Return time in ns.234 * cros_ec_get_time_ns() - Return time in ns.
245 *235 *