leds: is31fl319x: simplify getting the adapter of a client
diff mbox series

Message ID 20190722181416.6743-1-wsa+renesas@sang-engineering.com
State Awaiting Upstream
Headers show
Series
  • leds: is31fl319x: simplify getting the adapter of a client
Related show

Commit Message

Wolfram Sang July 22, 2019, 6:14 p.m. UTC
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/leds/leds-is31fl319x.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jacek Anaszewski July 23, 2019, 7:02 p.m. UTC | #1
Hi Wolfram,

Thank you for the patch.

On 7/22/19 8:14 PM, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/leds/leds-is31fl319x.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
> index 2d077b8edd0e..ca6634b8683c 100644
> --- a/drivers/leds/leds-is31fl319x.c
> +++ b/drivers/leds/leds-is31fl319x.c
> @@ -333,12 +333,11 @@ static int is31fl319x_probe(struct i2c_client *client,
>  {
>  	struct is31fl319x_chip *is31;
>  	struct device *dev = &client->dev;
> -	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
>  	int err;
>  	int i = 0;
>  	u32 aggregated_led_microamp = IS31FL319X_CURRENT_MAX;
>  
> -	if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
> +	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
>  		return -EIO;
>  
>  	is31 = devm_kzalloc(&client->dev, sizeof(*is31), GFP_KERNEL);
> 

Applied.

Patch
diff mbox series

diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index 2d077b8edd0e..ca6634b8683c 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -333,12 +333,11 @@  static int is31fl319x_probe(struct i2c_client *client,
 {
 	struct is31fl319x_chip *is31;
 	struct device *dev = &client->dev;
-	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
 	int err;
 	int i = 0;
 	u32 aggregated_led_microamp = IS31FL319X_CURRENT_MAX;
 
-	if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
 		return -EIO;
 
 	is31 = devm_kzalloc(&client->dev, sizeof(*is31), GFP_KERNEL);