iio: dac: mcp4725: Replace variable 'id' from struct mcp4725_data
authorBiju Das <biju.das.jz@bp.renesas.com>
Sun, 3 Sep 2023 11:55:45 +0000 (12:55 +0100)
committerJonathan Cameron <jonathan.cameron@huawei.com>
Tue, 12 Sep 2023 09:42:04 +0000 (10:42 +0100)
Replace the variable 'id' from struct mcp4725_data with local variable
chip_id in probe() as the id variable is not used elsewhere in the
driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230903115548.59306-2-biju.das.jz@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/mcp4725.c

index f4a3124..33a61f6 100644 (file)
@@ -32,7 +32,6 @@
 
 struct mcp4725_data {
        struct i2c_client *client;
-       int id;
        unsigned ref_mode;
        bool vref_buffered;
        u16 dac_value;
@@ -387,6 +386,7 @@ static int mcp4725_probe(struct i2c_client *client)
        struct mcp4725_data *data;
        struct iio_dev *indio_dev;
        struct mcp4725_platform_data *pdata, pdata_dt;
+       int chip_id;
        u8 inbuf[4];
        u8 pd;
        u8 ref;
@@ -399,9 +399,9 @@ static int mcp4725_probe(struct i2c_client *client)
        i2c_set_clientdata(client, indio_dev);
        data->client = client;
        if (dev_fwnode(&client->dev))
-               data->id = (uintptr_t)device_get_match_data(&client->dev);
+               chip_id = (uintptr_t)device_get_match_data(&client->dev);
        else
-               data->id = id->driver_data;
+               chip_id = id->driver_data;
        pdata = dev_get_platdata(&client->dev);
 
        if (!pdata) {
@@ -414,7 +414,7 @@ static int mcp4725_probe(struct i2c_client *client)
                pdata = &pdata_dt;
        }
 
-       if (data->id == MCP4725 && pdata->use_vref) {
+       if (chip_id == MCP4725 && pdata->use_vref) {
                dev_err(&client->dev,
                        "external reference is unavailable on MCP4725");
                return -EINVAL;
@@ -455,12 +455,12 @@ static int mcp4725_probe(struct i2c_client *client)
 
        indio_dev->name = id->name;
        indio_dev->info = &mcp4725_info;
-       indio_dev->channels = &mcp472x_channel[id->driver_data];
+       indio_dev->channels = &mcp472x_channel[chip_id];
        indio_dev->num_channels = 1;
        indio_dev->modes = INDIO_DIRECT_MODE;
 
        /* read current DAC value and settings */
-       err = i2c_master_recv(client, inbuf, data->id == MCP4725 ? 3 : 4);
+       err = i2c_master_recv(client, inbuf, chip_id == MCP4725 ? 3 : 4);
 
        if (err < 0) {
                dev_err(&client->dev, "failed to read DAC value");
@@ -470,10 +470,10 @@ static int mcp4725_probe(struct i2c_client *client)
        data->powerdown = pd > 0;
        data->powerdown_mode = pd ? pd - 1 : 2; /* largest resistor to gnd */
        data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
-       if (data->id == MCP4726)
+       if (chip_id == MCP4726)
                ref = (inbuf[3] >> 3) & 0x3;
 
-       if (data->id == MCP4726 && ref != data->ref_mode) {
+       if (chip_id == MCP4726 && ref != data->ref_mode) {
                dev_info(&client->dev,
                        "voltage reference mode differs (conf: %u, eeprom: %u), setting %u",
                        data->ref_mode, ref, data->ref_mode);