lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080507162820.4ecd1b55@core>
Date:	Wed, 7 May 2008 16:28:20 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	<JosephChan@....com.tw>
Cc:	<JosephChan@....com.tw>, <akpm@...ux-foundation.org>,
	<geert@...ux-m68k.org>, <linux-fbdev-devel@...ts.sourceforge.net>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [Linux-fbdev-devel] [PATCH 3/9] viafb: VIA Frame Buffer Device
 Driver

> +	/* Indentify GFX Chip Name */
> +	pdev =
> +	    (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
> +					     UNICHROME_CLE266_DID, NULL);
> +	if (pdev != NULL)
> +		chip_info.gfx_chip_name = UNICHROME_CLE266;
> +
> +	pdev =
> +	    (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
> +					     UNICHROME_K400_DID, NULL);

pci_get_device takes a reference so you need to do a pci_dev_put() on the
result if you have finished with it. Alternatively you could make use of
pci_dev_present()

> +	case UNICHROME_CLE266:
> +		pdev =
> +		    (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
> +						     UNICHROME_CLE266_DID,

Similar issue here.


> +void get_fb_info(unsigned int *fb_base, unsigned int *fb_len)
> +{
> +	struct pci_dev *pdev = NULL;
> +
> +	switch (chip_info.gfx_chip_name) {
> +	case UNICHROME_CLE266:
> +		pdev =
> +		    (struct pci_dev *)pci_get_device(PCI_VIA_VENDOR_ID,
> +						     UNICHROME_CLE266_DID,
> +						     NULL);

And here

So it might be better to for example use an array of types and keep the
array reference in the probe function pci_device_id field (which is how a
lot of stuff like libata drivers avoid doing messy lookups)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ