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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Dec 2007 00:49:57 +0100
From:	Johannes Weiner <hannes@...urebad.de>
To:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc:	linux-pci@...ey.karlin.mff.cuni.cz, Alan Cox <alan@...hat.com>,
	Greg Kroah-Hartman <greg@...ah.com>, <jgarzik@...ox.com>,
	Ivan Kokshaysky <ink@...assic.park.msu.ru>,
	<wingel@...o-system.com>,
	Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
	<james.smart@...lex.com>, <linux-driver@...gic.com>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [RFC/PATCH 1/4] pci: Add pci_enable_device_{io,mem} intefaces

Hi Benjamin,

Benjamin Herrenschmidt <benh@...nel.crashing.org> writes:

> --- linux-work.orig/drivers/pci/pci.c	2007-12-18 09:37:56.000000000 +1100
> +++ linux-work/drivers/pci/pci.c	2007-12-18 09:38:25.000000000 +1100
> [...]
> +int pci_enable_device_io(struct pci_dev *dev)
> +{
> +	int err;
> +	int i, bars = 0;
> +
> +	if (atomic_add_return(1, &dev->enable_cnt) > 1)
> +		return 0;		/* already enabled */
> +
> +	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
> +		if (dev->resource[i].flags & IORESOURCE_IO)
> +			bars |= (1 << i);
> +
> +	err = do_pci_enable_device(dev, bars);
> +	if (err < 0)
> +		atomic_dec(&dev->enable_cnt);
> +	return err;
> +}
> [...]
> +int pci_enable_device_mem(struct pci_dev *dev)
> +{
> +	int err;
> +	int i, bars = 0;
> +
> +	if (atomic_add_return(1, &dev->enable_cnt) > 1)
> +		return 0;		/* already enabled */
> +
> +	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
> +		if (dev->resource[i].flags & IORESOURCE_MEM)
> +			bars |= (1 << i);
> +
> +	err = do_pci_enable_device(dev, bars);
> +	if (err < 0)
> +		atomic_dec(&dev->enable_cnt);
> +	return err;
> +}

These two functions should be refactored, the only difference is the
flag checking.

	Hannes
--
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