Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcd42ed3 authored by David Howells's avatar David Howells Committed by David Howells
Browse files

mn10300: Use pci_claim_resource



Instead of open-coding pci_find_parent_resource and request_resource,
just call pci_claim_resource.

Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent e4acfcac
Loading
Loading
Loading
Loading
+6 −10
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
	struct pci_bus *bus;
	struct pci_bus *bus;
	struct pci_dev *dev;
	struct pci_dev *dev;
	int idx;
	int idx;
	struct resource *r, *pr;
	struct resource *r;


	/* Depth-First Search on bus tree */
	/* Depth-First Search on bus tree */
	list_for_each_entry(bus, bus_list, node) {
	list_for_each_entry(bus, bus_list, node) {
@@ -105,10 +105,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
				r = &dev->resource[idx];
				r = &dev->resource[idx];
				if (!r->flags)
				if (!r->flags)
					continue;
					continue;
				pr = pci_find_parent_resource(dev, r);
				if (!r->start ||
				if (!r->start ||
				    !pr ||
				    pci_claim_resource(dev, idx) < 0) {
				    request_resource(pr, r) < 0) {
					printk(KERN_ERR "PCI:"
					printk(KERN_ERR "PCI:"
					       " Cannot allocate resource"
					       " Cannot allocate resource"
					       " region %d of bridge %s\n",
					       " region %d of bridge %s\n",
@@ -131,7 +129,7 @@ static void __init pcibios_allocate_resources(int pass)
	struct pci_dev *dev = NULL;
	struct pci_dev *dev = NULL;
	int idx, disabled;
	int idx, disabled;
	u16 command;
	u16 command;
	struct resource *r, *pr;
	struct resource *r;


	for_each_pci_dev(dev) {
	for_each_pci_dev(dev) {
		pci_read_config_word(dev, PCI_COMMAND, &command);
		pci_read_config_word(dev, PCI_COMMAND, &command);
@@ -150,8 +148,7 @@ static void __init pcibios_allocate_resources(int pass)
				    " (f=%lx, d=%d, p=%d)\n",
				    " (f=%lx, d=%d, p=%d)\n",
				    pci_name(dev), r->start, r->end, r->flags,
				    pci_name(dev), r->start, r->end, r->flags,
				    disabled, pass);
				    disabled, pass);
				pr = pci_find_parent_resource(dev, r);
				if (pci_claim_resource(dev, idx) < 0) {
				if (!pr || request_resource(pr, r) < 0) {
					printk(KERN_ERR "PCI:"
					printk(KERN_ERR "PCI:"
					       " Cannot allocate resource"
					       " Cannot allocate resource"
					       " region %d of device %s\n",
					       " region %d of device %s\n",
@@ -184,7 +181,7 @@ static void __init pcibios_allocate_resources(int pass)
static int __init pcibios_assign_resources(void)
static int __init pcibios_assign_resources(void)
{
{
	struct pci_dev *dev = NULL;
	struct pci_dev *dev = NULL;
	struct resource *r, *pr;
	struct resource *r;


	if (!(pci_probe & PCI_ASSIGN_ROMS)) {
	if (!(pci_probe & PCI_ASSIGN_ROMS)) {
		/* Try to use BIOS settings for ROMs, otherwise let
		/* Try to use BIOS settings for ROMs, otherwise let
@@ -194,8 +191,7 @@ static int __init pcibios_assign_resources(void)
			r = &dev->resource[PCI_ROM_RESOURCE];
			r = &dev->resource[PCI_ROM_RESOURCE];
			if (!r->flags || !r->start)
			if (!r->flags || !r->start)
				continue;
				continue;
			pr = pci_find_parent_resource(dev, r);
			if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
			if (!pr || request_resource(pr, r) < 0) {
				r->end -= r->start;
				r->end -= r->start;
				r->start = 0;
				r->start = 0;
			}
			}