diff mbox series

[1/2] acpi: Fail GED probe when not on hardware-reduced

Message ID 20191009130433.29134-2-sameo@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show
Series acpi: Unconditional GED build | expand

Commit Message

Samuel Ortiz Oct. 9, 2019, 1:04 p.m. UTC
The Generic Event Device (GED) is a hardware-reduced platform device.
Probing this driver on fixed platforms should fail.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 drivers/acpi/evged.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Rafael J. Wysocki Oct. 11, 2019, 10:38 a.m. UTC | #1
On Wed, Oct 9, 2019 at 3:04 PM Samuel Ortiz <sameo@linux.intel.com> wrote:
>
> The Generic Event Device (GED) is a hardware-reduced platform device.

No, it is not AFAICS.

The spec doesn't say that GED cannot be used on platforms that aren't
HW-reduced and if evged.c is going to be built in unconditionally, the
kernel will be able to handle GED regardless.

> Probing this driver on fixed platforms should fail.
>
> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
> ---
>  drivers/acpi/evged.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
> index aba0d0027586..55de4b2d2fee 100644
> --- a/drivers/acpi/evged.c
> +++ b/drivers/acpi/evged.c
> @@ -127,6 +127,9 @@ static int ged_probe(struct platform_device *pdev)
>         struct acpi_ged_device *geddev;
>         acpi_status acpi_ret;
>
> +       if (!acpi_gbl_reduced_hardware)
> +               return -ENODEV;
> +
>         geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
>         if (!geddev)
>                 return -ENOMEM;
> --
> 2.21.0
>
Samuel Ortiz Oct. 11, 2019, 12:14 p.m. UTC | #2
On Fri, Oct 11, 2019 at 12:38:49PM +0200, Rafael J. Wysocki wrote:
> On Wed, Oct 9, 2019 at 3:04 PM Samuel Ortiz <sameo@linux.intel.com> wrote:
> >
> > The Generic Event Device (GED) is a hardware-reduced platform device.
> 
> No, it is not AFAICS.
It's a little confusing, I was not sure what's the common understanding
and tried to be safe by not having non HW-reduced machines getting a
new device that they've never seen so far.


> The spec doesn't say that GED cannot be used on platforms that aren't
> HW-reduced
I agree.

>  and if evged.c is going to be built in unconditionally, the
> kernel will be able to handle GED regardless.
Ok, perfect then. Does that mean you're ok with the 2nd patch but are
going to drop this one?

Cheers,
Samuel.
Rafael J. Wysocki Oct. 14, 2019, 8:55 a.m. UTC | #3
On Fri, Oct 11, 2019 at 2:14 PM Samuel Ortiz <sameo@linux.intel.com> wrote:
>
> On Fri, Oct 11, 2019 at 12:38:49PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Oct 9, 2019 at 3:04 PM Samuel Ortiz <sameo@linux.intel.com> wrote:
> > >
> > > The Generic Event Device (GED) is a hardware-reduced platform device.
> >
> > No, it is not AFAICS.
> It's a little confusing, I was not sure what's the common understanding
> and tried to be safe by not having non HW-reduced machines getting a
> new device that they've never seen so far.

I really don't expect firmware to expose GED for such machines (why
would it?), but if it does so, then why not to handle it?

> > The spec doesn't say that GED cannot be used on platforms that aren't
> > HW-reduced
> I agree.
>
> >  and if evged.c is going to be built in unconditionally, the
> > kernel will be able to handle GED regardless.
> Ok, perfect then. Does that mean you're ok with the 2nd patch but are
> going to drop this one?

Sure, I will apply the second patch only.

Thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
index aba0d0027586..55de4b2d2fee 100644
--- a/drivers/acpi/evged.c
+++ b/drivers/acpi/evged.c
@@ -127,6 +127,9 @@  static int ged_probe(struct platform_device *pdev)
 	struct acpi_ged_device *geddev;
 	acpi_status acpi_ret;
 
+	if (!acpi_gbl_reduced_hardware)
+		return -ENODEV;
+
 	geddev = devm_kzalloc(&pdev->dev, sizeof(*geddev), GFP_KERNEL);
 	if (!geddev)
 		return -ENOMEM;