|
@@ -349,7 +349,8 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
{
|
|
|
struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
|
|
|
struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
|
|
|
- struct device_node *of_node = client->dev.of_node;
|
|
|
+ struct device *dev = &client->dev;
|
|
|
+ struct device_node *np = dev->of_node;
|
|
|
bool idle_disconnect_dt;
|
|
|
struct gpio_desc *gpio;
|
|
|
int num, force, class;
|
|
@@ -360,8 +361,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
|
|
|
return -ENODEV;
|
|
|
|
|
|
- muxc = i2c_mux_alloc(adap, &client->dev,
|
|
|
- PCA954X_MAX_NCHANS, sizeof(*data), 0,
|
|
|
+ muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0,
|
|
|
pca954x_select_chan, pca954x_deselect_mux);
|
|
|
if (!muxc)
|
|
|
return -ENOMEM;
|
|
@@ -371,7 +371,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
data->client = client;
|
|
|
|
|
|
/* Reset the mux if a reset GPIO is specified. */
|
|
|
- gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
|
|
|
+ gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
|
|
if (IS_ERR(gpio))
|
|
|
return PTR_ERR(gpio);
|
|
|
if (gpio) {
|
|
@@ -381,7 +381,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
udelay(1);
|
|
|
}
|
|
|
|
|
|
- data->chip = of_device_get_match_data(&client->dev);
|
|
|
+ data->chip = of_device_get_match_data(dev);
|
|
|
if (!data->chip)
|
|
|
data->chip = &chips[id->driver_data];
|
|
|
|
|
@@ -395,8 +395,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
if (!ret &&
|
|
|
(id.manufacturer_id != data->chip->id.manufacturer_id ||
|
|
|
id.part_id != data->chip->id.part_id)) {
|
|
|
- dev_warn(&client->dev,
|
|
|
- "unexpected device id %03x-%03x-%x\n",
|
|
|
+ dev_warn(dev, "unexpected device id %03x-%03x-%x\n",
|
|
|
id.manufacturer_id, id.part_id,
|
|
|
id.die_revision);
|
|
|
return -ENODEV;
|
|
@@ -408,14 +407,14 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
* initializes the mux to disconnected state.
|
|
|
*/
|
|
|
if (i2c_smbus_write_byte(client, 0) < 0) {
|
|
|
- dev_warn(&client->dev, "probe failed\n");
|
|
|
+ dev_warn(dev, "probe failed\n");
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
|
|
|
data->last_chan = 0; /* force the first selection */
|
|
|
|
|
|
- idle_disconnect_dt = of_node &&
|
|
|
- of_property_read_bool(of_node, "i2c-mux-idle-disconnect");
|
|
|
+ idle_disconnect_dt = np &&
|
|
|
+ of_property_read_bool(np, "i2c-mux-idle-disconnect");
|
|
|
|
|
|
ret = pca954x_irq_setup(muxc);
|
|
|
if (ret)
|
|
@@ -446,7 +445,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
}
|
|
|
|
|
|
if (data->irq) {
|
|
|
- ret = devm_request_threaded_irq(&client->dev, data->client->irq,
|
|
|
+ ret = devm_request_threaded_irq(dev, data->client->irq,
|
|
|
NULL, pca954x_irq_handler,
|
|
|
IRQF_ONESHOT | IRQF_SHARED,
|
|
|
"pca954x", data);
|
|
@@ -454,8 +453,7 @@ static int pca954x_probe(struct i2c_client *client,
|
|
|
goto fail_cleanup;
|
|
|
}
|
|
|
|
|
|
- dev_info(&client->dev,
|
|
|
- "registered %d multiplexed busses for I2C %s %s\n",
|
|
|
+ dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n",
|
|
|
num, data->chip->muxtype == pca954x_ismux
|
|
|
? "mux" : "switch", client->name);
|
|
|
|