On Thu, Feb 21, 2019 at 04:04:40PM +0800, Matt Hsiao wrote:
> Instead of having explicit if statments excluding devices,
> use a pci_device_id table of devices to blacklist.
> 
> Signed-off-by: Matt Hsiao <matt.hs...@hpe.com>
> ---
>  drivers/misc/hpilo.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
> index 01c407a..0224e50 100644
> --- a/drivers/misc/hpilo.c
> +++ b/drivers/misc/hpilo.c
> @@ -29,6 +29,11 @@
>  static unsigned int ilo_major;
>  static unsigned int max_ccb = 16;
>  static char ilo_hwdev[MAX_ILO_DEV];
> +static const struct pci_device_id ilo_blacklist[] = {
> +     /* auxiliary iLO */
> +     {PCI_DEVICE_SUB(PCI_VENDOR_ID_HP, 0x3307, PCI_VENDOR_ID_HP, 0x1979)},
> +     {}
> +};
>  
>  static inline int get_entry_id(int entry)
>  {
> @@ -763,10 +768,10 @@ static int ilo_probe(struct pci_dev *pdev,
>       int devnum, minor, start, error = 0;
>       struct ilo_hwinfo *ilo_hw;
>  
> -     /* Ignore auxiliary iLO device */
> -     if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
> -         pdev->subsystem_device == 0x1979)
> -             return 0;
> +     if (pci_match_id(ilo_blacklist, pdev)) {
> +             dev_dbg(&pdev->dev, "Not supported on this device\n");
> +             return -ENODEV;
> +     }

Why not just merge this into the previous patch?

And why do some devices need to be blacklisted, shouldn't there only be
a whitelist in the first place?  Do you need to tighten up your original
device ids?

thanks,

greg k-h

Reply via email to