Use a helper function for accessing the device struct of the base
i2c client. This routine is named in a way that reflects its purpose
unlike the previously hand-coded dereferencing.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return &at24->client[i];
}
+static struct device *at24_base_client_dev(struct at24_data *at24)
+{
+ return &at24->client[0].client->dev;
+}
+
static size_t at24_adjust_read_count(struct at24_data *at24,
unsigned int offset, size_t count)
{
int ret;
at24 = priv;
- dev = &at24->client[0].client->dev;
+ dev = at24_base_client_dev(at24);
if (unlikely(!count))
return count;
int ret;
at24 = priv;
- dev = &at24->client[0].client->dev;
+ dev = at24_base_client_dev(at24);
if (unlikely(!count))
return -EINVAL;