Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Jihong Min <hurryman2212@icloud.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Jihong Min <hurryman2212@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
	linux-usb@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] hwmon: add AMD Promontory 21 xHCI temperature sensor support
Date: Sat, 9 May 2026 02:40:24 +0900	[thread overview]
Message-ID: <021e9b61-46f9-4429-85be-242bb12e70a4@icloud.com> (raw)
In-Reply-To: <f682afbb-e816-44e6-9b18-fc7e2335706e@amd.com>

 > Rather than using pm_ref as an output variable to indicate whether you
 > took a ref - how about you instead always take a ref on success and
 > return an error on fail? This would feel more logical to me.

Agreed. I changed the PM helper so success always means that a usage 
reference
is held, and the caller now unconditionally drops it with 
pm_runtime_put_noidle()
after the register access.

For the runtime PM disabled case, pm_runtime_get_if_active() returns 
-EINVAL.
In that case the helper now allows the read if the device is not marked
suspended, and uses pm_runtime_get_noresume() so the same success/put 
contract
is preserved without changing the runtime PM state.

 > guard(mutex) perhaps?

The private mutex is gone. Guenter pointed out that the hwmon core already
serializes the callbacks, so I removed the extra lock instead of 
converting it.

 > You only care about the first byte, right? Just use readb() and make
 > data a u8.

Done. The data register read now uses readb(), and the local data 
variable is
u8.

 > I personally don't really like changing the pointer when there is
 > potentially an error case with it for -ENODATA.

Done. The raw output pointer is only written after validating the read 
value.

 > Does 0xff actually happen with your runtime PM handling? Between my
 > suggestion above to use readb() this can turn into:
 >
 > if (!data)
 > return -ENODDATA;
 > *raw = data;
 >
 > return 0;

Done. I removed the 0xff invalid check. Suspended devices are rejected 
before
the MMIO access, so the read path now only treats zero as invalid and 
assigns
*raw after that check.

Sincerely,
Jihong Min


  reply	other threads:[~2026-05-08 17:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 14:39 [PATCH v4 0/2] AMD Promontory 21 xHCI temperature sensor support Jihong Min
2026-05-08 14:39 ` [PATCH v4 1/2] usb: xhci-pci: add AMD Promontory 21 PCI glue Jihong Min
2026-05-08 16:40   ` Mario Limonciello
2026-05-08 17:39     ` Jihong Min
2026-05-08 17:42       ` Mario Limonciello
2026-05-08 17:48         ` Jihong Min
2026-05-08 18:11           ` Jihong Min
2026-05-08 18:15             ` Guenter Roeck
2026-05-08 18:39               ` Jihong Min
2026-05-09  5:34         ` Jihong Min
2026-05-09  5:52           ` Mario Limonciello
2026-05-09  6:54             ` Jihong Min
2026-05-08 14:39 ` [PATCH v4 2/2] hwmon: add AMD Promontory 21 xHCI temperature sensor support Jihong Min
2026-05-08 15:45   ` Guenter Roeck
2026-05-08 17:37     ` Jihong Min
2026-05-08 16:51   ` Mario Limonciello
2026-05-08 17:40     ` Jihong Min [this message]
2026-05-08 21:52   ` sashiko-bot
2026-05-09  5:18     ` Jihong Min

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=021e9b61-46f9-4429-85be-242bb12e70a4@icloud.com \
    --to=hurryman2212@icloud.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hurryman2212@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mario.limonciello@amd.com \
    --cc=mathias.nyman@intel.com \
    --cc=skhan@linuxfoundation.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