From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Darren Hart <dvhart@infradead.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [update][PATCH 4/4] ACPI / scan: Rework modalias creation when "compatible" is present
Date: Fri, 10 Apr 2015 11:12:24 +0300 [thread overview]
Message-ID: <20150410081224.GO1734@lahna.fi.intel.com> (raw)
In-Reply-To: <1584233.lpv5odbKkI@vostro.rjw.lan>
On Thu, Apr 09, 2015 at 11:13:56PM +0200, Rafael J. Wysocki wrote:
> @@ -236,61 +264,89 @@ static struct acpi_device *acpi_companio
> return adev;
> }
>
> -/*
> - * Creates uevent modalias field for ACPI enumerated devices.
> - * Because the other buses does not support ACPI HIDs & CIDs.
> - * e.g. for a device with hid:IBM0001 and cid:ACPI0001 you get:
> - * "acpi:IBM0001:ACPI0001"
> - */
> -int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)
> +int __acpi_device_uevent_modalias(struct acpi_device *adev,
> + struct kobj_uevent_env *env)
> {
> int len;
>
> - if (!acpi_companion_match(dev))
> + if (!adev)
> return -ENODEV;
>
> if (add_uevent_var(env, "MODALIAS="))
> return -ENOMEM;
> - len = create_modalias(ACPI_COMPANION(dev), &env->buf[env->buflen - 1],
> - sizeof(env->buf) - env->buflen);
> - if (len <= 0)
> +
> + len = create_pnp_modalias(adev, &env->buf[env->buflen - 1],
> + sizeof(env->buf) - env->buflen);
> + if (len < 0) {
> + return len;
> + } else if (len > 0) {
> + env->buflen += len;
> +
> + if (add_uevent_var(env, "MODALIAS="))
> + return -ENOMEM;
If the device does not have compatible property the below will result
an empty MODALIAS= line in the uevent file:
# cat /sys/bus/i2c/devices/i2c-MSFT0002\:00/uevent
MODALIAS=acpi:MSFT0002:PNP0C50:
MODALIAS=
# cat /sys/bus/platform/devices/80860F0E\:00/uevent
DRIVER=pxa2xx-spi
MODALIAS=acpi:80860F0E:80860F0E:
MODALIAS=
> + }
> + len = create_of_modalias(adev, &env->buf[env->buflen - 1],
> + sizeof(env->buf) - env->buflen);
> + if (len < 0)
> return len;
> +
> env->buflen += len;
> +
> return 0;
> }
Following patch got rid of those. Not sure if that's the best place.
Perhaps we could move this to create_*_modalias() functions instead.
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 40b0a1b7f6f9..e0eb8161149c 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -282,6 +282,9 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,
} else if (len > 0) {
env->buflen += len;
+ if (!adev->data.of_compatible)
+ return 0;
+
if (add_uevent_var(env, "MODALIAS="))
return -ENOMEM;
}
next prev parent reply other threads:[~2015-04-10 8:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 0:18 [PATCH 0/4] ACPI / scan: Clean up the handling of the PRP0001 device ID Rafael J. Wysocki
2015-04-09 0:19 ` [PATCH 1/4] ACPI / scan: Generalize of_compatible matching Rafael J. Wysocki
2015-04-09 0:20 ` [PATCH 2/4] ACPI / scan: Simplify acpi_match_device() Rafael J. Wysocki
2015-04-09 0:21 ` [PATCH 3/4] ACPI / scan: Take PRP0001 in _CID lists into account too Rafael J. Wysocki
2015-04-09 1:28 ` [Update][PATCH 3/4] ACPI / scan: Take the PRP0001 position in the list of IDs into account Rafael J. Wysocki
2015-04-09 0:22 ` [PATCH 4/4] ACPI / scan: Rework modalias creation when "compatible" is present Rafael J. Wysocki
2015-04-09 12:27 ` Mika Westerberg
2015-04-09 17:39 ` Rafael J. Wysocki
2015-04-09 21:13 ` [update][PATCH " Rafael J. Wysocki
2015-04-10 8:12 ` Mika Westerberg [this message]
2015-04-10 12:34 ` Rafael J. Wysocki
2015-04-10 12:29 ` Mika Westerberg
2015-04-10 14:20 ` Rafael J. Wysocki
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=20150410081224.GO1734@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=dvhart@infradead.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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