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

Commit b2e93e94 authored by Jens Taprogge's avatar Jens Taprogge Committed by Greg Kroah-Hartman
Browse files

Staging: ipack/bridges/tpci200: Remove the read/write functions from ipack_bus_ops.



They are not used any longer.

Signed-off-by: default avatarJens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: default avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 64802dc8
Loading
Loading
Loading
Loading
+0 −218
Original line number Diff line number Diff line
@@ -51,218 +51,6 @@ static struct tpci200_board *check_slot(struct ipack_device *dev)
	return tpci200;
}

static inline unsigned char __tpci200_read8(void __iomem *address,
					    unsigned long offset)
{
	return ioread8(address + offset);
}

static inline unsigned short __tpci200_read16(void __iomem *address,
					      unsigned long offset)
{
	return ioread16be(address + offset);
}

static inline unsigned int __tpci200_read32(void __iomem *address,
					    unsigned long offset)
{
	return ioread32be(address + offset);
}

static inline void __tpci200_write8(unsigned char value,
				    void __iomem *address, unsigned long offset)
{
	iowrite8(value, address + offset);
}

static inline void __tpci200_write16(unsigned short value,
				     void __iomem *address,
				     unsigned long offset)
{
	iowrite16be(value, address + offset);
}

static inline void __tpci200_write32(unsigned int value,
				     void __iomem *address,
				     unsigned long offset)
{
	iowrite32be(value, address + offset);
}

static struct ipack_addr_space *get_slot_address_space(struct ipack_device *dev,
						       int space)
{
	struct ipack_addr_space *addr;

	switch (space) {
	case IPACK_IO_SPACE:
		addr = &dev->io_space;
		break;
	case IPACK_ID_SPACE:
		addr = &dev->id_space;
		break;
	case IPACK_MEM_SPACE:
		addr = &dev->mem_space;
		break;
	default:
		dev_err(&dev->dev,
			"Slot [%d:%d] space number %d doesn't exist !\n",
			dev->bus_nr, dev->slot, space);
		return NULL;
		break;
	}

	if ((addr->size == 0) || (addr->address == NULL)) {
		dev_err(&dev->dev, "Error, slot space not mapped !\n");
		return NULL;
	}

	return addr;
}

static int tpci200_read8(struct ipack_device *dev, int space,
			 unsigned long offset, unsigned char *value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if (offset >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}

	*value = __tpci200_read8(addr->address, offset);

	return 0;
}

static int tpci200_read16(struct ipack_device *dev, int space,
			  unsigned long offset, unsigned short *value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if ((offset+2) >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}
	*value = __tpci200_read16(addr->address, offset);

	return 0;
}

static int tpci200_read32(struct ipack_device *dev, int space,
			  unsigned long offset, unsigned int *value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if ((offset+4) >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}

	*value = __tpci200_read32(addr->address, offset);

	return 0;
}

static int tpci200_write8(struct ipack_device *dev, int space,
			  unsigned long offset, unsigned char value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if (offset >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}

	__tpci200_write8(value, addr->address, offset);

	return 0;
}

static int tpci200_write16(struct ipack_device *dev, int space,
			   unsigned long offset, unsigned short value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if ((offset+2) >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}

	__tpci200_write16(value, addr->address, offset);

	return 0;
}

static int tpci200_write32(struct ipack_device *dev, int space,
			   unsigned long offset, unsigned int value)
{
	struct ipack_addr_space *addr;
	struct tpci200_board *tpci200;

	tpci200 = check_slot(dev);
	if (tpci200 == NULL)
		return -EINVAL;

	addr = get_slot_address_space(dev, space);
	if (addr == NULL)
		return -EINVAL;

	if ((offset+4) >= addr->size) {
		dev_err(&dev->dev, "Error, slot space offset error !\n");
		return -EFAULT;
	}

	__tpci200_write32(value, addr->address, offset);

	return 0;
}

static void tpci200_unregister(struct tpci200_board *tpci200)
{
	int i;
@@ -749,12 +537,6 @@ static struct ipack_bus_ops tpci200_bus_ops = {
	.unmap_space = tpci200_slot_unmap_space,
	.request_irq = tpci200_request_irq,
	.free_irq = tpci200_free_irq,
	.read8 = tpci200_read8,
	.read16 = tpci200_read16,
	.read32 = tpci200_read32,
	.write8 = tpci200_write8,
	.write16 = tpci200_write16,
	.write32 = tpci200_write32,
	.remove_device = tpci200_slot_unregister,
};