mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Joaquín Ignacio Aramendía" <samsagax@gmail.com>
Cc: derekjohn.clark@gmail.com, jdelvare@suse.com,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (oxp-sensors) Stop passing device structure
Date: Thu, 25 May 2023 07:55:01 -0700	[thread overview]
Message-ID: <3ccbd2d9-42f1-4270-9835-29911855cc79@roeck-us.net> (raw)
In-Reply-To: <20230525142652.41981-1-samsagax@gmail.com>

On Thu, May 25, 2023 at 11:26:52AM -0300, Joaquín Ignacio Aramendía wrote:
> We don't need to pass device structure to write_to_ec() so we remove
> that from the function declaration.
> The same is valid for pwm_enable() and pwm_disable() as we were passing
> the pointer to hand it off to write_to_ec().
> 
> Signed-off-by: Joaquín Ignacio Aramendía <samsagax@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/oxp-sensors.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
> index a4ee757f879f..0ec7588610ad 100644
> --- a/drivers/hwmon/oxp-sensors.c
> +++ b/drivers/hwmon/oxp-sensors.c
> @@ -141,7 +141,7 @@ static int read_from_ec(u8 reg, int size, long *val)
>  	return 0;
>  }
>  
> -static int write_to_ec(const struct device *dev, u8 reg, u8 value)
> +static int write_to_ec(u8 reg, u8 value)
>  {
>  	int ret;
>  
> @@ -156,14 +156,14 @@ static int write_to_ec(const struct device *dev, u8 reg, u8 value)
>  	return ret;
>  }
>  
> -static int oxp_pwm_enable(const struct device *dev)
> +static int oxp_pwm_enable(void)
>  {
> -	return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x01);
> +	return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, 0x01);
>  }
>  
> -static int oxp_pwm_disable(const struct device *dev)
> +static int oxp_pwm_disable(void)
>  {
> -	return write_to_ec(dev, OXP_SENSOR_PWM_ENABLE_REG, 0x00);
> +	return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, 0x00);
>  }
>  
>  /* Callbacks for hwmon interface */
> @@ -234,9 +234,9 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
>  		switch (attr) {
>  		case hwmon_pwm_enable:
>  			if (val == 1)
> -				return oxp_pwm_enable(dev);
> +				return oxp_pwm_enable();
>  			else if (val == 0)
> -				return oxp_pwm_disable(dev);
> +				return oxp_pwm_disable();
>  			return -EINVAL;
>  		case hwmon_pwm_input:
>  			if (val < 0 || val > 255)
> @@ -254,7 +254,7 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
>  			default:
>  				break;
>  			}
> -			return write_to_ec(dev, OXP_SENSOR_PWM_REG, val);
> +			return write_to_ec(OXP_SENSOR_PWM_REG, val);
>  		default:
>  			break;
>  		}

      reply	other threads:[~2023-05-25 14:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 14:26 Joaquín Ignacio Aramendía
2023-05-25 14:55 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ccbd2d9-42f1-4270-9835-29911855cc79@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=derekjohn.clark@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samsagax@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®