diff mbox series

[2/3] platform/x86: intel_int0002_vgpio: Use the new soc_intel_is_byt/cht helpers

Message ID 20211018143324.296961-3-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series ASoC/pdx86/input: Introduce and use soc_intel_is_*() helpers | expand

Commit Message

Hans de Goede Oct. 18, 2021, 2:33 p.m. UTC
Use the new soc_intel_is_byt/cht helpers to clean things up a bit.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/intel/int0002_vgpio.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Andy Shevchenko Oct. 18, 2021, 3:03 p.m. UTC | #1
On Mon, Oct 18, 2021 at 5:33 PM Hans de Goede <hdegoede@redhat.com> wrote:

Couple of nit-picks below (may be ignored).

> Use the new soc_intel_is_byt/cht helpers to clean things up a bit.

soc_intel_is_byt()/soc_intel_is_cht() (or anything alike to show that
these are functions / macros).

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/intel/int0002_vgpio.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/int0002_vgpio.c b/drivers/platform/x86/intel/int0002_vgpio.c
> index 569342aa8926..617dbf98980e 100644
> --- a/drivers/platform/x86/intel/int0002_vgpio.c
> +++ b/drivers/platform/x86/intel/int0002_vgpio.c
> @@ -34,13 +34,11 @@
>  #include <linux/io.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/platform_data/x86/soc.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <linux/suspend.h>
>
> -#include <asm/cpu_device_id.h>
> -#include <asm/intel-family.h>
> -
>  #define DRV_NAME                       "INT0002 Virtual GPIO"
>
>  /* For some reason the virtual GPIO pin tied to the GPE is numbered pin 2 */
> @@ -151,12 +149,6 @@ static struct irq_chip int0002_irqchip = {
>         .irq_set_wake           = int0002_irq_set_wake,
>  };
>
> -static const struct x86_cpu_id int0002_cpu_ids[] = {
> -       X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL),
> -       X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL),
> -       {}
> -};
> -
>  static void int0002_init_irq_valid_mask(struct gpio_chip *chip,
>                                         unsigned long *valid_mask,
>                                         unsigned int ngpios)
> @@ -167,15 +159,13 @@ static void int0002_init_irq_valid_mask(struct gpio_chip *chip,
>  static int int0002_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
> -       const struct x86_cpu_id *cpu_id;
>         struct int0002_data *int0002;
>         struct gpio_irq_chip *girq;
>         struct gpio_chip *chip;
>         int irq, ret;
>
>         /* Menlow has a different INT0002 device? <sigh> */
> -       cpu_id = x86_match_cpu(int0002_cpu_ids);
> -       if (!cpu_id)

> +       if (!soc_intel_is_byt() && !soc_intel_is_cht())

  if (!(soc_intel_is_byt() || soc_intel_is_cht()))

?

>                 return -ENODEV;
>
>         irq = platform_get_irq(pdev, 0);
> --
> 2.31.1
>
Andy Shevchenko Oct. 18, 2021, 3:08 p.m. UTC | #2
On Mon, Oct 18, 2021 at 6:03 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Oct 18, 2021 at 5:33 PM Hans de Goede <hdegoede@redhat.com> wrote:

...

> > +       if (!soc_intel_is_byt() && !soc_intel_is_cht())
>
>   if (!(soc_intel_is_byt() || soc_intel_is_cht()))
>
> ?

Self-nak on this. && is slightly better in case we got the first
argument false. Proposed variant will always evaluate both.
diff mbox series

Patch

diff --git a/drivers/platform/x86/intel/int0002_vgpio.c b/drivers/platform/x86/intel/int0002_vgpio.c
index 569342aa8926..617dbf98980e 100644
--- a/drivers/platform/x86/intel/int0002_vgpio.c
+++ b/drivers/platform/x86/intel/int0002_vgpio.c
@@ -34,13 +34,11 @@ 
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/platform_data/x86/soc.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/suspend.h>
 
-#include <asm/cpu_device_id.h>
-#include <asm/intel-family.h>
-
 #define DRV_NAME			"INT0002 Virtual GPIO"
 
 /* For some reason the virtual GPIO pin tied to the GPE is numbered pin 2 */
@@ -151,12 +149,6 @@  static struct irq_chip int0002_irqchip = {
 	.irq_set_wake		= int0002_irq_set_wake,
 };
 
-static const struct x86_cpu_id int0002_cpu_ids[] = {
-	X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL),
-	X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL),
-	{}
-};
-
 static void int0002_init_irq_valid_mask(struct gpio_chip *chip,
 					unsigned long *valid_mask,
 					unsigned int ngpios)
@@ -167,15 +159,13 @@  static void int0002_init_irq_valid_mask(struct gpio_chip *chip,
 static int int0002_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	const struct x86_cpu_id *cpu_id;
 	struct int0002_data *int0002;
 	struct gpio_irq_chip *girq;
 	struct gpio_chip *chip;
 	int irq, ret;
 
 	/* Menlow has a different INT0002 device? <sigh> */
-	cpu_id = x86_match_cpu(int0002_cpu_ids);
-	if (!cpu_id)
+	if (!soc_intel_is_byt() && !soc_intel_is_cht())
 		return -ENODEV;
 
 	irq = platform_get_irq(pdev, 0);