mirror of https://gitee.com/openkylin/linux.git
i2c: designware: Rename i2c_dw_probe() to i2c_dw_probe_master()
As a preparatory patch to support slave mode for PCI enumerated devices rename i2c_dw_probe() to i2c_dw_probe_master() and split common i2c_dw_probe() as inline helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
parent
42ab001234
commit
bed20c8402
|
@ -49,7 +49,8 @@ obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o
|
|||
obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
|
||||
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
|
||||
obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o
|
||||
i2c-designware-core-objs := i2c-designware-common.o i2c-designware-master.o
|
||||
i2c-designware-core-objs := i2c-designware-common.o
|
||||
i2c-designware-core-objs += i2c-designware-master.o
|
||||
ifeq ($(CONFIG_I2C_DESIGNWARE_SLAVE),y)
|
||||
i2c-designware-core-objs += i2c-designware-slave.o
|
||||
endif
|
||||
|
|
|
@ -315,7 +315,7 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
|
|||
void __i2c_dw_disable(struct dw_i2c_dev *dev);
|
||||
|
||||
extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);
|
||||
extern int i2c_dw_probe(struct dw_i2c_dev *dev);
|
||||
extern int i2c_dw_probe_master(struct dw_i2c_dev *dev);
|
||||
|
||||
#if IS_ENABLED(CONFIG_I2C_DESIGNWARE_SLAVE)
|
||||
extern void i2c_dw_configure_slave(struct dw_i2c_dev *dev);
|
||||
|
@ -325,6 +325,19 @@ static inline void i2c_dw_configure_slave(struct dw_i2c_dev *dev) { }
|
|||
static inline int i2c_dw_probe_slave(struct dw_i2c_dev *dev) { return -EINVAL; }
|
||||
#endif
|
||||
|
||||
static inline int i2c_dw_probe(struct dw_i2c_dev *dev)
|
||||
{
|
||||
switch (dev->mode) {
|
||||
case DW_IC_SLAVE:
|
||||
return i2c_dw_probe_slave(dev);
|
||||
case DW_IC_MASTER:
|
||||
return i2c_dw_probe_master(dev);
|
||||
default:
|
||||
dev_err(dev->dev, "Wrong operation mode: %d\n", dev->mode);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void i2c_dw_configure(struct dw_i2c_dev *dev)
|
||||
{
|
||||
if (i2c_detect_slave_mode(dev->dev))
|
||||
|
|
|
@ -727,7 +727,7 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int i2c_dw_probe(struct dw_i2c_dev *dev)
|
||||
int i2c_dw_probe_master(struct dw_i2c_dev *dev)
|
||||
{
|
||||
struct i2c_adapter *adap = &dev->adapter;
|
||||
unsigned long irq_flags;
|
||||
|
@ -794,7 +794,7 @@ int i2c_dw_probe(struct dw_i2c_dev *dev)
|
|||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(i2c_dw_probe);
|
||||
EXPORT_SYMBOL_GPL(i2c_dw_probe_master);
|
||||
|
||||
MODULE_DESCRIPTION("Synopsys DesignWare I2C bus master adapter");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -271,7 +271,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
|
|||
ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
|
||||
adap->nr = controller->bus_num;
|
||||
|
||||
r = i2c_dw_probe(dev);
|
||||
r = i2c_dw_probe_master(dev);
|
||||
if (r) {
|
||||
pci_free_irq_vectors(pdev);
|
||||
return r;
|
||||
|
|
|
@ -331,11 +331,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
|
|||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
if (dev->mode == DW_IC_SLAVE)
|
||||
ret = i2c_dw_probe_slave(dev);
|
||||
else
|
||||
ret = i2c_dw_probe(dev);
|
||||
|
||||
ret = i2c_dw_probe(dev);
|
||||
if (ret)
|
||||
goto exit_probe;
|
||||
|
||||
|
|
Loading…
Reference in New Issue