From: Guenter Roeck <linux@roeck-us.net>
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
jdelvare@suse.com
Subject: Re: [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use default debugfs attributes and lock function
Date: Fri, 7 Apr 2023 09:10:15 -0700 [thread overview]
Message-ID: <9c3d277f-a23b-447f-8850-354f54deb07b@roeck-us.net> (raw)
In-Reply-To: <20230405145230.68631-3-eajames@linux.ibm.com>
On Wed, Apr 05, 2023 at 09:52:30AM -0500, Eddie James wrote:
> Switch the driver to use the default debugfs attributes instead of
> ones that provide the same data under different names. Use the lock
> functions for the debugfs and led attributes, and simplify the input
> history operation by dropping the timer and lock.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> drivers/hwmon/pmbus/ibm-cffps.c | 273 ++++++++++++++------------------
> 1 file changed, 118 insertions(+), 155 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index e3294a1a54bb..2d7ec00e047b 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -18,12 +18,6 @@
>
[ ... ]
> }
> @@ -225,29 +183,27 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf,
> rc = i * 4;
> break;
> default:
> - return -EOPNOTSUPP;
> + rc = -EOPNOTSUPP;
> + break;
> }
> - goto done;
> + break;
> case CFFPS_DEBUGFS_ON_OFF_CONFIG:
> - rc = i2c_smbus_read_byte_data(psu->client,
> - PMBUS_ON_OFF_CONFIG);
> - if (rc < 0)
> - return rc;
> -
> - rc = snprintf(data, 3, "%02x", rc);
> - goto done;
> + rc = i2c_smbus_read_byte_data(psu->client, PMBUS_ON_OFF_CONFIG);
> + if (rc >= 0)
> + rc = snprintf(data, 3, "%02x", rc);
> + break;
> default:
> - return -EINVAL;
> + rc = -EINVAL;
> + break;
> }
>
> - rc = i2c_smbus_read_block_data(psu->client, cmd, data);
> +unlock:
> + pmbus_unlock(psu->client);
> if (rc < 0)
> return rc;
>
> -done:
> data[rc] = '\n';
> rc += 2;
> -
I hate to say (repeat) that, but please refrain from whitespace changes.
Guenter
> return simple_read_from_buffer(buf, count, ppos, data, rc);
> }
next prev parent reply other threads:[~2023-04-07 16:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 14:52 [PATCH 0/2] hwmon: (pmbus/core) Add lock and unlock functions Eddie James
2023-04-05 14:52 ` [PATCH 1/2] " Eddie James
2023-04-05 14:52 ` [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use default debugfs attributes and lock function Eddie James
2023-04-07 16:10 ` Guenter Roeck [this message]
2023-04-12 15:24 ` Eddie James
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=9c3d277f-a23b-447f-8850-354f54deb07b@roeck-us.net \
--to=linux@roeck-us.net \
--cc=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).