linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Aleksa Savic <savicaleksa83@gmail.com>, linux-hwmon@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Jonathan Corbet <corbet@lwn.net>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers
Date: Sun, 3 Dec 2023 16:26:02 +0100	[thread overview]
Message-ID: <5404194d-9ee6-4def-a040-f5858d8c2d66@wanadoo.fr> (raw)
In-Reply-To: <121470f0-6c1f-418a-844c-7ec2e8a54b8e@gmail.com>

Le 03/12/2023 à 16:00, Aleksa Savic a écrit :
>>> +static int waterforce_probe(struct hid_device *hdev, const struct hid_device_id *id)
>>> +{
>>> +    struct waterforce_data *priv;
>>> +    int ret;
>>> +
>>> +    priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL);
>>> +    if (!priv)
>>> +        return -ENOMEM;
>>> +
>>> +    priv->hdev = hdev;
>>> +    hid_set_drvdata(hdev, priv);
>>> +
>>> +    /*
>>> +     * Initialize priv->updated to STATUS_VALIDITY seconds in the past, making
>>> +     * the initial empty data invalid for waterforce_read() without the need for
>>> +     * a special case there.
>>> +     */
>>> +    priv->updated = jiffies - msecs_to_jiffies(STATUS_VALIDITY);
>>> +
>>> +    ret = hid_parse(hdev);
>>> +    if (ret) {
>>> +        hid_err(hdev, "hid parse failed with %d\n", ret);
>>> +        return ret;
>>> +    }
>>> +
>>> +    /*
>>> +     * Enable hidraw so existing user-space tools can continue to work.
>>> +     */
>>> +    ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
>>> +    if (ret) {
>>> +        hid_err(hdev, "hid hw start failed with %d\n", ret);
>>> +        goto fail_and_stop;
>>
>> Should this be 'return ret;' (the _start has failed, so why stop?)
> 
> Hm, yes.
> 
>>
>>> +    }
>>> +
>>> +    ret = hid_hw_open(hdev);
>>> +    if (ret) {
>>> +        hid_err(hdev, "hid hw open failed with %d\n", ret);
>>> +        goto fail_and_close;
>>
>> Should this be 'fail_and_stop' (the _open has failed, so why close?)
> 
> Also yes... I based this part on the nzxt-kraken2 driver in the tree,
> perhaps that should be investigated as well. The aquacomputer_d5next driver
> seems to be doing it correctly.

Done, patch sent.

CH


  reply	other threads:[~2023-12-03 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 12:06 [PATCH v2] hwmon: Add driver for Gigabyte AORUS Waterforce AIO coolers Aleksa Savic
2023-12-03 14:14 ` Christophe JAILLET
2023-12-03 15:00   ` Aleksa Savic
2023-12-03 15:26     ` Christophe JAILLET [this message]
2023-12-04 12:31       ` Aleksa Savic
2023-12-03 17:36 ` Guenter Roeck
2023-12-05 14:22   ` Aleksa Savic
2023-12-05 14:35     ` Guenter Roeck
2023-12-07 12:21       ` Aleksa Savic

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=5404194d-9ee6-4def-a040-f5858d8c2d66@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=corbet@lwn.net \
    --cc=jdelvare@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=savicaleksa83@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;
as well as URLs for NNTP newsgroup(s).