Skip to content

Commit 2a036e4

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as an integer. Use it instead of custom approach. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5db72fd commit 2a036e4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ static struct pwm_lookup byt_pwm_lookup[] = {
167167

168168
static void byt_pwm_setup(struct lpss_private_data *pdata)
169169
{
170-
struct acpi_device *adev = pdata->adev;
170+
u64 uid;
171171

172172
/* Only call pwm_add_table for the first PWM controller */
173-
if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
173+
if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
174174
return;
175175

176176
pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
@@ -180,14 +180,13 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)
180180

181181
static void byt_i2c_setup(struct lpss_private_data *pdata)
182182
{
183-
const char *uid_str = acpi_device_uid(pdata->adev);
184183
acpi_handle handle = pdata->adev->handle;
185184
unsigned long long shared_host = 0;
186185
acpi_status status;
187-
long uid = 0;
186+
u64 uid;
188187

189-
/* Expected to always be true, but better safe then sorry */
190-
if (uid_str && !kstrtol(uid_str, 10, &uid) && uid) {
188+
/* Expected to always be successfull, but better safe then sorry */
189+
if (!acpi_dev_uid_to_integer(pdata->adev, &uid) && uid) {
191190
/* Detect I2C bus shared with PUNIT and ignore its d3 status */
192191
status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
193192
if (ACPI_SUCCESS(status) && shared_host)
@@ -211,10 +210,10 @@ static struct pwm_lookup bsw_pwm_lookup[] = {
211210

212211
static void bsw_pwm_setup(struct lpss_private_data *pdata)
213212
{
214-
struct acpi_device *adev = pdata->adev;
213+
u64 uid;
215214

216215
/* Only call pwm_add_table for the first PWM controller */
217-
if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
216+
if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
218217
return;
219218

220219
pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));

0 commit comments

Comments
 (0)