@@ -32,7 +32,6 @@ struct i2c_mux_priv {
struct i2c_adapter adap;
struct i2c_algorithm algo;
struct i2c_mux_core *muxc;
- struct device *mux_dev;
u32 chan_id;
};
@@ -139,7 +138,6 @@ struct i2c_mux_core *i2c_mux_alloc(struct device *dev, int sizeof_priv)
EXPORT_SYMBOL_GPL(i2c_mux_alloc);
int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
- struct device *mux_dev,
u32 force_nr, u32 chan_id,
unsigned int class)
{
@@ -164,7 +162,6 @@ int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
/* Set up private adapter data */
priv->muxc = muxc;
- priv->mux_dev = mux_dev;
priv->chan_id = chan_id;
/* Need to do algo dynamically because we don't know ahead
@@ -199,11 +196,11 @@ int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
* Try to populate the mux adapter's of_node, expands to
* nothing if !CONFIG_OF.
*/
- if (mux_dev->of_node) {
+ if (muxc->dev->of_node) {
struct device_node *child;
u32 reg;
- for_each_child_of_node(mux_dev->of_node, child) {
+ for_each_child_of_node(muxc->dev->of_node, child) {
ret = of_property_read_u32(child, "reg", ®);
if (ret)
continue;
@@ -217,8 +214,9 @@ int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
/*
* Associate the mux channel with an ACPI node.
*/
- if (has_acpi_companion(mux_dev))
- acpi_preset_companion(&priv->adap.dev, ACPI_COMPANION(mux_dev),
+ if (has_acpi_companion(muxc->dev))
+ acpi_preset_companion(&priv->adap.dev,
+ ACPI_COMPANION(muxc->dev),
chan_id);
if (force_nr) {
@@ -235,12 +233,14 @@ int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
return ret;
}
- WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"),
- "can't create symlink to mux device\n");
+ WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
+ "mux_device"),
+ "can't create symlink to mux device\n");
snprintf(symlink_name, sizeof(symlink_name), "channel-%u", chan_id);
- WARN(sysfs_create_link(&mux_dev->kobj, &priv->adap.dev.kobj, symlink_name),
- "can't create symlink for channel %u\n", chan_id);
+ WARN(sysfs_create_link(&muxc->dev->kobj, &priv->adap.dev.kobj,
+ symlink_name),
+ "can't create symlink for channel %u\n", chan_id);
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
i2c_adapter_id(&priv->adap));
@@ -261,7 +261,7 @@ void i2c_del_mux_adapters(struct i2c_mux_core *muxc)
snprintf(symlink_name, sizeof(symlink_name),
"channel-%u", priv->chan_id);
- sysfs_remove_link(&priv->mux_dev->kobj, symlink_name);
+ sysfs_remove_link(&muxc->dev->kobj, symlink_name);
sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
i2c_del_adapter(adap);
@@ -204,7 +204,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
}
/* Actually add the mux adapter */
- ret = i2c_add_mux_adapter(muxc, dev, 0, 0, 0);
+ ret = i2c_add_mux_adapter(muxc, 0, 0, 0);
if (ret) {
dev_err(dev, "Failed to add adapter\n");
i2c_put_adapter(muxc->parent);
@@ -216,8 +216,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
u32 nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
unsigned int class = mux->data.classes ? mux->data.classes[i] : 0;
- ret = i2c_add_mux_adapter(muxc, &pdev->dev, nr,
- mux->data.values[i], class);
+ ret = i2c_add_mux_adapter(muxc, nr, mux->data.values[i], class);
if (ret) {
dev_err(&pdev->dev, "Failed to add adapter %d\n", i);
goto add_adapter_failed;
@@ -361,7 +361,7 @@ static int pca9541_probe(struct i2c_client *client,
force = 0;
if (pdata)
force = pdata->modes[0].adap_id;
- ret = i2c_add_mux_adapter(muxc, &client->dev, force, 0, 0);
+ ret = i2c_add_mux_adapter(muxc, force, 0, 0);
if (ret) {
dev_err(&client->dev, "failed to register master selector\n");
return ret;
@@ -256,8 +256,7 @@ static int pca954x_probe(struct i2c_client *client,
|| idle_disconnect_dt) << num;
}
- ret = i2c_add_mux_adapter(muxc, &client->dev,
- force, num, class);
+ ret = i2c_add_mux_adapter(muxc, force, num, class);
if (ret) {
dev_err(&client->dev,
@@ -212,8 +212,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
u32 bus = mux->pdata->base_bus_num ?
(mux->pdata->base_bus_num + i) : 0;
- ret = i2c_add_mux_adapter(muxc, &pdev->dev,
- bus, i, 0);
+ ret = i2c_add_mux_adapter(muxc, bus, i, 0);
if (ret) {
dev_err(&pdev->dev, "Failed to add adapter %d\n", i);
goto err_del_adapter;
@@ -227,8 +227,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
nr = mux->data.base_nr ? (mux->data.base_nr + i) : 0;
class = mux->data.classes ? mux->data.classes[i] : 0;
- ret = i2c_add_mux_adapter(muxc, &pdev->dev, nr,
- mux->data.values[i], class);
+ ret = i2c_add_mux_adapter(muxc, nr, mux->data.values[i], class);
if (ret) {
dev_err(&pdev->dev, "Failed to add adapter %d\n", i);
goto add_adapter_failed;
@@ -849,7 +849,7 @@ static int inv_mpu_probe(struct i2c_client *client,
st->muxc->select = inv_mpu6050_select_bypass;
st->muxc->deselect = inv_mpu6050_deselect_bypass;
- result = i2c_add_mux_adapter(st->muxc, &client->dev, 0, 0, 0);
+ result = i2c_add_mux_adapter(st->muxc, 0, 0, 0);
if (result)
goto out_unreg_device;
@@ -1476,7 +1476,7 @@ static int m88ds3103_probe(struct i2c_client *client,
dev->muxc->select = m88ds3103_select;
/* create mux i2c adapter for tuner */
- ret = i2c_add_mux_adapter(dev->muxc, &client->dev, 0, 0, 0);
+ ret = i2c_add_mux_adapter(dev->muxc, 0, 0, 0);
if (ret)
goto err_kfree;
@@ -874,7 +874,7 @@ static int rtl2830_probe(struct i2c_client *client,
dev->muxc->select = rtl2830_select;
/* create muxed i2c adapter for tuner */
- ret = i2c_add_mux_adapter(dev->muxc, &client->dev, 0, 0, 0);
+ ret = i2c_add_mux_adapter(dev->muxc, 0, 0, 0);
if (ret)
goto err_regmap_exit;
@@ -1271,7 +1271,7 @@ static int rtl2832_probe(struct i2c_client *client,
dev->muxc->deselect = rtl2832_deselect;
/* create muxed i2c adapter for demod tuner bus */
- ret = i2c_add_mux_adapter(dev->muxc, &i2c->dev, 0, 0, 0);
+ ret = i2c_add_mux_adapter(dev->muxc, 0, 0, 0);
if (ret)
goto err_regmap_exit;
@@ -719,7 +719,7 @@ static int si2168_probe(struct i2c_client *client,
dev->muxc->deselect = si2168_deselect;
/* create mux i2c adapter for tuner */
- ret = i2c_add_mux_adapter(dev->muxc, &client->dev, 0, 0, 0);
+ ret = i2c_add_mux_adapter(dev->muxc, 0, 0, 0);
if (ret)
goto err_kfree;
@@ -577,12 +577,9 @@ int cx231xx_i2c_mux_create(struct cx231xx *dev)
int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
{
- /* what is the correct mux_dev? */
- struct device *mux_dev = dev->dev;
int rc;
rc = i2c_add_mux_adapter(dev->muxc,
- mux_dev,
0,
mux_no /* chan_id */,
0 /* class */);
@@ -1722,7 +1722,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client,
if (ret)
return ret;
for (i = 0; i < nchans; i++) {
- ret = i2c_add_mux_adapter(muxc, dev, 0, i, 0);
+ ret = i2c_add_mux_adapter(muxc, 0, i, 0);
if (ret) {
dev_err(dev, "Failed to register mux #%d\n", i);
i2c_del_mux_adapters(muxc);
@@ -56,7 +56,6 @@ int i2c_mux_reserve_adapters(struct i2c_mux_core *muxc, int adapters);
* mux control.
*/
int i2c_add_mux_adapter(struct i2c_mux_core *muxc,
- struct device *mux_dev,
u32 force_nr, u32 chan_id,
unsigned int class);