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

Commit 2ce80087 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Greg Kroah-Hartman
Browse files

mcb: introduce mcb_get_resource()



Introduce mcb_get_resource() as a common accessor to a mcb device's memory or
IRQ resources.

Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5aabd3b0
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -417,6 +417,22 @@ void mcb_bus_add_devices(const struct mcb_bus *bus)
}
EXPORT_SYMBOL_GPL(mcb_bus_add_devices);

/**
 * mcb_get_resource() - get a resource for a mcb device
 * @dev: the mcb device
 * @type: the type of resource
 */
struct resource *mcb_get_resource(struct mcb_device *dev, unsigned int type)
{
	if (type == IORESOURCE_MEM)
		return &dev->mem;
	else if (type == IORESOURCE_IRQ)
		return &dev->irq;
	else
		return NULL;
}
EXPORT_SYMBOL_GPL(mcb_get_resource);

/**
 * mcb_request_mem() - Request memory
 * @dev: The @mcb_device the memory is for
@@ -460,7 +476,9 @@ EXPORT_SYMBOL_GPL(mcb_release_mem);

static int __mcb_get_irq(struct mcb_device *dev)
{
	struct resource *irq = &dev->irq;
	struct resource *irq;

	irq = mcb_get_resource(dev, IORESOURCE_IRQ);

	return irq->start;
}
+2 −0
Original line number Diff line number Diff line
@@ -136,5 +136,7 @@ extern struct resource *mcb_request_mem(struct mcb_device *dev,
					const char *name);
extern void mcb_release_mem(struct resource *mem);
extern int mcb_get_irq(struct mcb_device *dev);
extern struct resource *mcb_get_resource(struct mcb_device *dev,
					 unsigned int type);

#endif /* _LINUX_MCB_H */