input synaptics-rmi4: Transport layer renaming.
Subsystems (2)
PATCH 1/1 input synaptics-rmi4: Transport layer renaming.
The current RMI4 driver uses the term "physical" for two different logical
entities: the communications transport layer (I2C, SPI, and so on), and the actual RMI4 device that is being communicated with. Such usage makes the code harder to understand due to confusion as to just which elements are being referred to.
This patch renames the transport layer elements in order to eliminate this confusion. Much of the renaming was accomplished by the following Bash script
#!/bin/bash
#
# Update RMI4 driver transport layer naming.
#
files="rmi_bus.c rmi_bus.h rmi_driver.c rmi_driver.h rmi_f01.c rmi_i2c.c" cd drivers/input/rmi4
for f in $files ; do
echo $f
sed -i.bak s/rmi_phys_device/rmi_transport_dev/g $f
sed -i.bak s/rmi_phys_info/rmi_transport_info/g $f
sed -i.bak "s/rmi_transport_dev \*phys/rmi_transport_dev \*xport/g" $f sed -i.bak "s/rmi_transport_dev \*rmi_phys/rmi_transport_dev \*xport/g" $f sed -i.bak "s/phys\([^i]\)/xport\1/g" $f
sed -i.bak "s/->phys/->xport/g" $f
sed -i.bak "s/register_physical_device/register_transport_device/g" $f sed -i.bak "s/physical_device_count/transport_device_count/g" $f
done
although some changes proved easier to simply do by hand, particularly in the comments. Changes are confined strictly to the renaming, to keep the patch relatively simple.
---
drivers/input/rmi4/rmi_bus.c | 38 ++++++++--------- drivers/input/rmi4/rmi_bus.h | 54 ++++++++++++------------- drivers/input/rmi4/rmi_driver.c | 32 +++++++-------- drivers/input/rmi4/rmi_driver.h | 2 +- drivers/input/rmi4/rmi_i2c.c | 90 ++++++++++++++++++++--------------------- 5 files changed, 108 insertions(+), 108 deletions(-)
drivers/input/rmi4/rmi_bus.c +19 -19
@@ -76,38 +76,38 @@ static void rmi_physical_teardown_debugfs(struct rmi_device *rmi_dev)#endif /** -* rmi_register_physical_device - register a physical device connection on the RMI -* bus. Physical drivers provide communication from the devices on the bus to -* the RMI4 sensor on a bus such as SPI, I2C, and so on. +* rmi_register_transport_device - register a transport device connection +* on the RMI bus. Transport drivers provide communication from the devices +* on a bus (such as SPI, I2C, and so on) to the RMI4 sensor. * -* @phys: the physical device to register +* @xport: the transport device to register */ -int rmi_register_physical_device (struct rmi_phys_device *phys) +int rmi_register_transport_device (struct rmi_transport_dev *xport) { -static atomic_t physical_device_count =ATOMIC_INIT (0 ); -struct rmi_device_platform_data *pdata = phys->dev->platform_data; +static atomic_t transport_device_count =ATOMIC_INIT (0 ); +struct rmi_device_platform_data *pdata = xport->dev->platform_data;struct rmi_device *rmi_dev;int error;if (!pdata) { -dev_err (phys->dev,"no platform data!\n" ); +dev_err (xport->dev,"no platform data!\n" );return -EINVAL ; } - rmi_dev =devm_kzalloc (phys->dev, + rmi_dev =devm_kzalloc (xport->dev,sizeof (struct rmi_device ),GFP_KERNEL );if (!rmi_dev)return -ENOMEM ; - rmi_dev->phys = phys; - rmi_dev->number =atomic_inc_return (&physical_device_count) -1 ; + rmi_dev->xport = xport; + rmi_dev->number =atomic_inc_return (&transport_device_count) -1 ;dev_set_name (&rmi_dev->dev,"sensor%02d" , rmi_dev->number); rmi_dev->dev.bus = &rmi_bus_type; rmi_dev->dev.type = &rmi_device_type; - phys->rmi_dev = rmi_dev; + xport->rmi_dev = rmi_dev;rmi_physical_setup_debugfs (rmi_dev);
@@ -115,26 +115,26 @@ int rmi_register_physical_device(struct rmi_phys_device *phys)if (error)return error; -dev_dbg (phys->dev,"%s: Registered %s as %s.\n" , __func__, +dev_dbg (xport->dev,"%s: Registered %s as %s.\n" , __func__, pdata->sensor_name,dev_name (&rmi_dev->dev));return 0 ; } -EXPORT_SYMBOL_GPL (rmi_register_physical_device); +EXPORT_SYMBOL_GPL (rmi_register_transport_device);/** -* rmi_unregister_physical_device - unregister a physical device connection -* @phys: the physical driver to unregister +* rmi_unregister_transport_device - unregister a transport device connection +* @xport: the transport driver to unregister * */ -void rmi_unregister_physical_device (struct rmi_phys_device *phys) +void rmi_unregister_transport_device (struct rmi_transport_dev *xport) { -struct rmi_device *rmi_dev = phys->rmi_dev; +struct rmi_device *rmi_dev = xport->rmi_dev;rmi_physical_teardown_debugfs (rmi_dev);device_unregister (&rmi_dev->dev); } -EXPORT_SYMBOL (rmi_unregister_physical_device); +EXPORT_SYMBOL (rmi_unregister_transport_device);/* Function specific stuff */
drivers/input/rmi4/rmi_bus.h +27 -27
159 lines not on this page · raw message
drivers/input/rmi4/rmi_driver.c +16 -16
@@ -45,16 +45,16 @@static irqreturn_t rmi_irq_thread (int irq,void *p) { -struct rmi_phys_device *phys = p; -struct rmi_device *rmi_dev = phys->rmi_dev; +struct rmi_transport_dev *xport = p; +struct rmi_device *rmi_dev = xport->rmi_dev;struct rmi_driver *driver = rmi_dev->driver; -struct rmi_device_platform_data *pdata = phys->dev->platform_data; +struct rmi_device_platform_data *pdata = xport->dev->platform_data;struct rmi_driver_data *data; data =dev_get_drvdata (&rmi_dev->dev);if (IRQ_DEBUG (data)) -dev_dbg (phys->dev,"ATTN gpio, value: %d.\n" , +dev_dbg (xport->dev,"ATTN gpio, value: %d.\n" ,gpio_get_value (pdata->attn_gpio));if (gpio_get_value (pdata->attn_gpio) == pdata->attn_polarity) {
@@ -124,12 +124,12 @@ static void disable_sensor(struct rmi_device *rmi_dev)if (!data->irq)disable_polling (rmi_dev); -if (rmi_dev->phys->disable_device) - rmi_dev->phys->disable_device (rmi_dev->phys); +if (rmi_dev->xport->disable_device) + rmi_dev->xport->disable_device (rmi_dev->xport);if (data->irq) {disable_irq (data->irq); -free_irq (data->irq, rmi_dev->phys); +free_irq (data->irq, rmi_dev->xport); } data->enabled = false;
@@ -138,27 +138,27 @@ static void disable_sensor(struct rmi_device *rmi_dev)static int enable_sensor (struct rmi_device *rmi_dev) {struct rmi_driver_data *data =dev_get_drvdata (&rmi_dev->dev); -struct rmi_phys_device *rmi_phys; +struct rmi_transport_dev *xport;int retval =0 ;struct rmi_device_platform_data *pdata =to_rmi_platform_data (rmi_dev);if (data->enabled)return 0 ; -if (rmi_dev->phys->enable_device) { - retval = rmi_dev->phys->enable_device (rmi_dev->phys); +if (rmi_dev->xport->enable_device) { + retval = rmi_dev->xport->enable_device (rmi_dev->xport);if (retval)return retval; } - rmi_phys = rmi_dev->phys; + xport = rmi_dev->xport;if (data->irq) { retval =request_threaded_irq (data->irq, - rmi_phys->hard_irq ? rmi_phys->hard_irq :NULL , - rmi_phys->irq_thread ? - rmi_phys->irq_thread : rmi_irq_thread, + xport->hard_irq ? xport->hard_irq :NULL , + xport->irq_thread ? + xport->irq_thread : rmi_irq_thread, data->irq_flags, -dev_name (&rmi_dev->dev), rmi_phys); +dev_name (&rmi_dev->dev), xport);if (retval)return retval; }else {
@@ -819,7 +819,7 @@ static int rmi_driver_probe(struct device *dev)dev_dbg (dev,"%s: Starting probe.\n" , __func__);if (!rmi_is_physical_device (dev)) { -dev_dbg (dev,"Not a sensor device.\n" ); +dev_dbg (dev,"Not a physical device.\n" );return -ENODEV ; }
drivers/input/rmi4/rmi_driver.h +1 -1
@@ -74,7 +74,7 @@ struct rmi_driver_data {#ifdef CONFIG_RMI4_DEBUG struct dentry *debugfs_delay; -struct dentry *debugfs_phys; +struct dentry *debugfs_xport;struct dentry *debugfs_reg_ctl;struct dentry *debugfs_reg;struct dentry *debugfs_irq;
drivers/input/rmi4/rmi_i2c.c +45 -45
226 lines not on this page · raw message
Quoted 29 lines · Christopher Heiny
The current RMI4 driver uses the term "physical" for two different logical
entities: the communications transport layer (I2C, SPI, and so on), and the actual RMI4 device that is being communicated with. Such usage makes the code harder to understand due to confusion as to just which elements are being referred to.This patch renames the transport layer elements in order to eliminate this confusion. Much of the renaming was accomplished by the following Bash script
#!/bin/bash
#
# Update RMI4 driver transport layer naming.
#files="rmi_bus.c
rmi_bus.hrmi_driver.crmi_driver.hrmi_f01.crmi_i2c.c" cddrivers/input/rmi4for f in $files ; do
echo $f
sed -i.bak s/rmi_phys_device/rmi_transport_dev/g $f
sed -i.bak s/rmi_phys_info/rmi_transport_info/g $f
sed -i.bak "s/rmi_transport_dev \*phys/rmi_transport_dev \*xport/g" $f sed -i.bak "s/rmi_transport_dev \*rmi_phys/rmi_transport_dev \*xport/g" $f sed -i.bak "s/phys\([^i]\)/xport\1/g" $f
sed -i.bak "s/->phys/->xport/g" $f
sed -i.bak "s/register_physical_device/register_transport_device/g" $f sed -i.bak "s/physical_device_count/transport_device_count/g" $f
done
Quoted 7 lines
although some changes proved easier to simply do by hand, particularly in the comments. Changes are confined strictly to the renaming, to keep the patch relatively simple.
Signed-off-by Christopher Heiny <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Benjamin Tissoires <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry