public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space.
@ 2012-09-13  9:46 Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 2/5] Staging: ipack: move the responsibility to clear interrupts to the IPack devices Samuel Iglesias Gonsalvez
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2012-09-13  9:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, industrypack-devel, Jens Taprogge,
	Samuel Iglesias Gonsalvez

From: Jens Taprogge <jens.taprogge@taprogge.org>

This will allow us to correctly access the IPack INT space.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/staging/ipack/bridges/tpci200.c |   29 +++++++++++++++++++++++++++++
 drivers/staging/ipack/bridges/tpci200.h |    2 ++
 drivers/staging/ipack/ipack.h           |    2 ++
 3 files changed, 33 insertions(+)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 21b2b75..3462783 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -95,6 +95,8 @@ static void tpci200_unregister(struct tpci200_board *tpci200)
 		tpci200->slots[i].io_phys.size = 0;
 		tpci200->slots[i].id_phys.address = NULL;
 		tpci200->slots[i].id_phys.size = 0;
+		tpci200->slots[i].int_phys.address = NULL;
+		tpci200->slots[i].int_phys.size = 0;
 		tpci200->slots[i].mem_phys.address = NULL;
 		tpci200->slots[i].mem_phys.size = 0;
 	}
@@ -331,6 +333,11 @@ static int tpci200_register(struct tpci200_board *tpci200)
 			TPCI200_ID_SPACE_OFF + TPCI200_ID_SPACE_GAP*i;
 		tpci200->slots[i].id_phys.size = TPCI200_ID_SPACE_SIZE;
 
+		tpci200->slots[i].int_phys.address =
+			(void __iomem *)ioidint_base +
+			TPCI200_INT_SPACE_OFF + TPCI200_INT_SPACE_GAP * i;
+		tpci200->slots[i].int_phys.size = TPCI200_INT_SPACE_SIZE;
+
 		tpci200->slots[i].mem_phys.address =
 			(void __iomem *)mem_base + TPCI200_MEM8_GAP*i;
 		tpci200->slots[i].mem_phys.size = TPCI200_MEM8_SIZE;
@@ -391,6 +398,15 @@ static int tpci200_slot_unmap_space(struct ipack_device *dev, int space)
 		}
 		virt_addr_space = &dev->id_space;
 		break;
+	case IPACK_INT_SPACE:
+		if (dev->int_space.address == NULL) {
+			dev_info(&dev->dev,
+				 "Slot [%d:%d] INT space not mapped !\n",
+				 dev->bus_nr, dev->slot);
+			goto out_unlock;
+		}
+		virt_addr_space = &dev->int_space;
+		break;
 	case IPACK_MEM_SPACE:
 		if (dev->mem_space.address == NULL) {
 			dev_info(&dev->dev,
@@ -460,6 +476,19 @@ static int tpci200_slot_map_space(struct ipack_device *dev,
 		phys_address = tpci200->slots[dev->slot].id_phys.address;
 		size_to_map = tpci200->slots[dev->slot].id_phys.size;
 		break;
+	case IPACK_INT_SPACE:
+		if (dev->int_space.address != NULL) {
+			dev_err(&dev->dev,
+				"Slot [%d:%d] INT space already mapped !\n",
+				tpci200->number, dev->slot);
+			res = -EINVAL;
+			goto out_unlock;
+		}
+		virt_addr_space = &dev->int_space;
+
+		phys_address = tpci200->slots[dev->slot].int_phys.address;
+		size_to_map = tpci200->slots[dev->slot].int_phys.size;
+		break;
 	case IPACK_MEM_SPACE:
 		if (dev->mem_space.address != NULL) {
 			dev_err(&dev->dev,
diff --git a/drivers/staging/ipack/bridges/tpci200.h b/drivers/staging/ipack/bridges/tpci200.h
index e1f60f3..235d1fe 100644
--- a/drivers/staging/ipack/bridges/tpci200.h
+++ b/drivers/staging/ipack/bridges/tpci200.h
@@ -132,6 +132,7 @@ struct slot_irq {
  * @irq		Slot IRQ infos
  * @io_phys	IO physical base address register of the slot
  * @id_phys	ID physical base address register of the slot
+ * @int_phys	INT physical base address register of the slot
  * @mem_phys	MEM physical base address register of the slot
  *
  */
@@ -139,6 +140,7 @@ struct tpci200_slot {
 	struct slot_irq		*irq;
 	struct ipack_addr_space io_phys;
 	struct ipack_addr_space id_phys;
+	struct ipack_addr_space int_phys;
 	struct ipack_addr_space mem_phys;
 };
 
diff --git a/drivers/staging/ipack/ipack.h b/drivers/staging/ipack/ipack.h
index 9c3079d..f8405df 100644
--- a/drivers/staging/ipack/ipack.h
+++ b/drivers/staging/ipack/ipack.h
@@ -35,6 +35,7 @@ enum ipack_space {
 	IPACK_IO_SPACE    = 0,
 	IPACK_ID_SPACE    = 1,
 	IPACK_MEM_SPACE   = 2,
+	IPACK_INT_SPACE,
 };
 
 /**
@@ -71,6 +72,7 @@ struct ipack_device {
 	struct ipack_bus_device *bus;
 	struct ipack_addr_space id_space;
 	struct ipack_addr_space io_space;
+	struct ipack_addr_space int_space;
 	struct ipack_addr_space mem_space;
 	struct device dev;
 	u8                      *id;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/5] Staging: ipack: move the responsibility to clear interrupts to the IPack devices.
  2012-09-13  9:46 [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space Samuel Iglesias Gonsalvez
@ 2012-09-13  9:46 ` Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device Samuel Iglesias Gonsalvez
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2012-09-13  9:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, industrypack-devel, Jens Taprogge,
	Samuel Iglesias Gonsalvez

From: Jens Taprogge <jens.taprogge@taprogge.org>

Now the IPack device acknowledges its own IRQ.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/staging/ipack/bridges/tpci200.c |    4 ----
 drivers/staging/ipack/devices/ipoctal.c |   19 +++++++++++++++++--
 drivers/staging/ipack/devices/scc2698.h |    3 +++
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 3462783..43f2f38 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -126,10 +126,6 @@ static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
 		return -ENODEV;
 	ret = slot_irq->handler(slot_irq->arg);
 
-	/* Clear the IPack device interrupt */
-	readw(slot_irq->holder->io_space.address + 0xC0);
-	readw(slot_irq->holder->io_space.address + 0xC2);
-
 	return ret;
 }
 
diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 0292364..30d8d42 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -252,6 +252,10 @@ static irqreturn_t ipoctal_irq_handler(void *arg)
 	for (i = 0; i < NR_CHANNELS; i++)
 		ipoctal_irq_channel(&ipoctal->channel[i]);
 
+	/* Clear the IPack device interrupt */
+	readw(ipoctal->dev->int_space.address + ACK_INT_REQ0);
+	readw(ipoctal->dev->int_space.address + ACK_INT_REQ1);
+
 	return IRQ_HANDLED;
 }
 
@@ -264,7 +268,6 @@ static int ipoctal_check_model(struct ipack_device *dev, unsigned char *id)
 	manufacturerID = ioread8(dev->id_space.address + IPACK_IDPROM_OFFSET_MANUFACTURER_ID);
 	if (manufacturerID != IPACK1_VENDOR_ID_SBS)
 		return -ENODEV;
-
 	board_id = ioread8(dev->id_space.address + IPACK_IDPROM_OFFSET_MODEL);
 	switch (board_id) {
 	case IPACK1_DEVICE_ID_SBS_OCTAL_232:
@@ -322,13 +325,22 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
 		goto out_unregister_id_space;
 	}
 
+	res = ipoctal->dev->bus->ops->map_space(ipoctal->dev, 0,
+						IPACK_INT_SPACE);
+	if (res) {
+		dev_err(&ipoctal->dev->dev,
+			"Unable to map slot [%d:%d] INT space!\n",
+			bus_nr, slot);
+		goto out_unregister_io_space;
+	}
+
 	res = ipoctal->dev->bus->ops->map_space(ipoctal->dev,
 					   0x8000, IPACK_MEM_SPACE);
 	if (res) {
 		dev_err(&ipoctal->dev->dev,
 			"Unable to map slot [%d:%d] MEM space!\n",
 			bus_nr, slot);
-		goto out_unregister_io_space;
+		goto out_unregister_int_space;
 	}
 
 	/* Save the virtual address to access the registers easily */
@@ -450,6 +462,8 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
 
 out_unregister_slot_unmap:
 	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_ID_SPACE);
+out_unregister_int_space:
+	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_INT_SPACE);
 out_unregister_io_space:
 	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_IO_SPACE);
 out_unregister_id_space:
@@ -735,6 +749,7 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)
 	tty_unregister_driver(ipoctal->tty_drv);
 	put_tty_driver(ipoctal->tty_drv);
 	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_MEM_SPACE);
+	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_INT_SPACE);
 	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_IO_SPACE);
 	ipoctal->dev->bus->ops->unmap_space(ipoctal->dev, IPACK_ID_SPACE);
 	kfree(ipoctal);
diff --git a/drivers/staging/ipack/devices/scc2698.h b/drivers/staging/ipack/devices/scc2698.h
index 223838a..96e8d8c 100644
--- a/drivers/staging/ipack/devices/scc2698.h
+++ b/drivers/staging/ipack/devices/scc2698.h
@@ -221,4 +221,7 @@ union scc2698_block {
 #define ISR_DELTA_BREAK_B           (0x1 << 6)
 #define ISR_INPUT_PORT_CHANGE       (0x1 << 7)
 
+#define ACK_INT_REQ0			0
+#define ACK_INT_REQ1			2
+
 #endif /* SCC2698_H_ */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device.
  2012-09-13  9:46 [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 2/5] Staging: ipack: move the responsibility to clear interrupts to the IPack devices Samuel Iglesias Gonsalvez
@ 2012-09-13  9:46 ` Samuel Iglesias Gonsalvez
  2012-09-13 10:01   ` Dan Carpenter
  2012-09-13  9:46 ` [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 5/5] Staging: ipack/devices/ipoctal: simplify ipoctal_write_tty() Samuel Iglesias Gonsalvez
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2012-09-13  9:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, industrypack-devel, Jens Taprogge,
	Samuel Iglesias Gonsalvez

From: Jens Taprogge <jens.taprogge@taprogge.org>

The field irq currently is identical to the slot number.  It does not seem to
have any real use.  The number is written to hardware in ipoctal but it seems
the value that is written does not matter.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/staging/ipack/bridges/tpci200.c |    9 ++-------
 drivers/staging/ipack/devices/ipoctal.c |    8 ++++----
 drivers/staging/ipack/ipack.c           |    3 +--
 drivers/staging/ipack/ipack.h           |    8 ++------
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 43f2f38..bb8aa70 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -190,7 +190,7 @@ static int tpci200_free_irq(struct ipack_device *dev)
 	return 0;
 }
 
-static int tpci200_request_irq(struct ipack_device *dev, int vector,
+static int tpci200_request_irq(struct ipack_device *dev,
 			       irqreturn_t (*handler)(void *), void *arg)
 {
 	int res = 0;
@@ -227,7 +227,6 @@ static int tpci200_request_irq(struct ipack_device *dev, int vector,
 	 * Read the User Manual of your IndustryPack device to know
 	 * where to write the vector in memory.
 	 */
-	slot_irq->vector = vector;
 	slot_irq->handler = handler;
 	slot_irq->arg = arg;
 	slot_irq->holder = dev;
@@ -715,12 +714,8 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
 	tpci200->number = tpci200->info->ipack_bus->bus_nr;
 	dev_set_drvdata(&pdev->dev, tpci200);
 
-	/*
-	 * Give the same IRQ number as the slot number.
-	 * The TPCI200 has assigned his own two IRQ by PCI bus driver
-	 */
 	for (i = 0; i < TPCI200_NB_SLOT; i++)
-		ipack_device_register(tpci200->info->ipack_bus, i, i);
+		ipack_device_register(tpci200->info->ipack_bus, i);
 	return 0;
 
 out_err_bus_register:
diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 30d8d42..0fd0e01 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -288,7 +288,7 @@ static const struct tty_port_operations ipoctal_tty_port_ops = {
 };
 
 static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
-			     unsigned int slot, unsigned int vector)
+			     unsigned int slot)
 {
 	int res = 0;
 	int i;
@@ -387,9 +387,9 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
 	 * Depending of the carrier these addresses are accesible or not.
 	 * More info in the datasheet.
 	 */
-	ipoctal->dev->bus->ops->request_irq(ipoctal->dev, vector,
+	ipoctal->dev->bus->ops->request_irq(ipoctal->dev,
 				       ipoctal_irq_handler, ipoctal);
-	iowrite8(vector, ipoctal->dev->mem_space.address + 1);
+	iowrite8(1, ipoctal->dev->mem_space.address + 1);
 
 	/* Register the TTY device */
 
@@ -722,7 +722,7 @@ static int ipoctal_probe(struct ipack_device *dev)
 		return -ENOMEM;
 
 	ipoctal->dev = dev;
-	res = ipoctal_inst_slot(ipoctal, dev->bus_nr, dev->slot, dev->irq);
+	res = ipoctal_inst_slot(ipoctal, dev->bus_nr, dev->slot);
 	if (res)
 		goto out_uninst;
 
diff --git a/drivers/staging/ipack/ipack.c b/drivers/staging/ipack/ipack.c
index c83f015..d1e0651 100644
--- a/drivers/staging/ipack/ipack.c
+++ b/drivers/staging/ipack/ipack.c
@@ -427,7 +427,7 @@ out:
 }
 
 struct ipack_device *ipack_device_register(struct ipack_bus_device *bus,
-					   int slot, int irqv)
+					   int slot)
 {
 	int ret;
 	struct ipack_device *dev;
@@ -441,7 +441,6 @@ struct ipack_device *ipack_device_register(struct ipack_bus_device *bus,
 	dev->dev.parent = bus->parent;
 	dev->slot = slot;
 	dev->bus_nr = bus->bus_nr;
-	dev->irq = irqv;
 	dev->bus = bus;
 	dev_set_name(&dev->dev,
 		     "ipack-dev.%u.%u", dev->bus_nr, dev->slot);
diff --git a/drivers/staging/ipack/ipack.h b/drivers/staging/ipack/ipack.h
index f8405df..d8e3bb6 100644
--- a/drivers/staging/ipack/ipack.h
+++ b/drivers/staging/ipack/ipack.h
@@ -54,7 +54,6 @@ struct ipack_addr_space {
  *
  *	@bus_nr: IP bus number where the device is plugged
  *	@slot: Slot where the device is plugged in the carrier board
- *	@irq: IRQ vector
  *	@bus: ipack_bus_device where the device is plugged to.
  *	@id_space: Virtual address to ID space.
  *	@io_space: Virtual address to IO space.
@@ -68,7 +67,6 @@ struct ipack_addr_space {
 struct ipack_device {
 	unsigned int bus_nr;
 	unsigned int slot;
-	unsigned int irq;
 	struct ipack_bus_device *bus;
 	struct ipack_addr_space id_space;
 	struct ipack_addr_space io_space;
@@ -129,7 +127,7 @@ struct ipack_driver {
 struct ipack_bus_ops {
 	int (*map_space) (struct ipack_device *dev, unsigned int memory_size, int space);
 	int (*unmap_space) (struct ipack_device *dev, int space);
-	int (*request_irq) (struct ipack_device *dev, int vector,
+	int (*request_irq) (struct ipack_device *dev,
 			    irqreturn_t (*handler)(void *), void *arg);
 	int (*free_irq) (struct ipack_device *dev);
 	int (*get_clockrate) (struct ipack_device *dev);
@@ -187,13 +185,11 @@ void ipack_driver_unregister(struct ipack_driver *edrv);
  *
  * @bus: ipack bus device it is plugged to.
  * @slot: slot position in the bus device.
- * @irqv: IRQ vector for the mezzanine.
  *
  * Register a new ipack device (mezzanine device). The call is done by
  * the carrier device driver.
  */
-struct ipack_device *ipack_device_register(struct ipack_bus_device *bus,
-					   int slot, int irqv);
+struct ipack_device *ipack_device_register(struct ipack_bus_device *bus, int slot);
 void ipack_device_unregister(struct ipack_device *dev);
 
 /**
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition.
  2012-09-13  9:46 [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 2/5] Staging: ipack: move the responsibility to clear interrupts to the IPack devices Samuel Iglesias Gonsalvez
  2012-09-13  9:46 ` [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device Samuel Iglesias Gonsalvez
@ 2012-09-13  9:46 ` Samuel Iglesias Gonsalvez
  2012-09-13 10:02   ` Dan Carpenter
  2012-09-13  9:46 ` [PATCH 5/5] Staging: ipack/devices/ipoctal: simplify ipoctal_write_tty() Samuel Iglesias Gonsalvez
  3 siblings, 1 reply; 9+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2012-09-13  9:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, industrypack-devel,
	Samuel Iglesias Gonsalvez

Clear the BREAK flag from the ISR register.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/staging/ipack/devices/ipoctal.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 0fd0e01..5f4545a 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -158,6 +158,7 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel,
 				flag = TTY_FRAME;
 			}
 			if (sr & SR_RECEIVED_BREAK) {
+				iowrite8(CR_CMD_RESET_BREAK_CHANGE, &channel->regs->w.cr);
 				channel->stats.rcv_break++;
 				flag = TTY_BREAK;
 			}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] Staging: ipack/devices/ipoctal: simplify ipoctal_write_tty()
  2012-09-13  9:46 [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space Samuel Iglesias Gonsalvez
                   ` (2 preceding siblings ...)
  2012-09-13  9:46 ` [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition Samuel Iglesias Gonsalvez
@ 2012-09-13  9:46 ` Samuel Iglesias Gonsalvez
  3 siblings, 0 replies; 9+ messages in thread
From: Samuel Iglesias Gonsalvez @ 2012-09-13  9:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, industrypack-devel,
	Samuel Iglesias Gonsalvez

Remove count_wr and the assigment of nb_bytes = 0 in that function as is
useless. Now it returns the count of the characters actually sent.

There is other nb_bytes = 0 deleted that has a duplicate a few lines before.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
 drivers/staging/ipack/devices/ipoctal.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 5f4545a..150fc75 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -33,7 +33,6 @@ static const struct tty_operations ipoctal_fops;
 struct ipoctal_channel {
 	struct ipoctal_stats		stats;
 	unsigned int			nb_bytes;
-	unsigned int			count_wr;
 	wait_queue_head_t		queue;
 	spinlock_t			lock;
 	unsigned int			pointer_read;
@@ -189,7 +188,6 @@ static void ipoctal_irq_tx(struct ipoctal_channel *channel)
 	value = channel->tty_port.xmit_buf[*pointer_write];
 	iowrite8(value, &channel->regs->w.thr);
 	channel->stats.tx++;
-	channel->count_wr++;
 	(*pointer_write)++;
 	*pointer_write = *pointer_write % PAGE_SIZE;
 	channel->nb_bytes--;
@@ -444,7 +442,6 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
 		spin_lock_init(&channel->lock);
 		channel->pointer_read = 0;
 		channel->pointer_write = 0;
-		channel->nb_bytes = 0;
 		tty_dev = tty_register_device(tty, i, NULL);
 		if (IS_ERR(tty_dev)) {
 			dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n");
@@ -499,11 +496,9 @@ static int ipoctal_write_tty(struct tty_struct *tty,
 			     const unsigned char *buf, int count)
 {
 	struct ipoctal_channel *channel = tty->driver_data;
+	unsigned int char_copied;
 
-	channel->nb_bytes = 0;
-	channel->count_wr = 0;
-
-	ipoctal_copy_write_buffer(channel, buf, count);
+	char_copied = ipoctal_copy_write_buffer(channel, buf, count);
 
 	/* As the IP-OCTAL 485 only supports half duplex, do it manually */
 	if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
@@ -520,7 +515,7 @@ static int ipoctal_write_tty(struct tty_struct *tty,
 	iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
 
 	*channel->board_write = 0;
-	return channel->count_wr;
+	return char_copied;
 }
 
 static int ipoctal_write_room(struct tty_struct *tty)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device.
  2012-09-13  9:46 ` [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device Samuel Iglesias Gonsalvez
@ 2012-09-13 10:01   ` Dan Carpenter
  2012-09-13 10:33     ` Samuel Iglesias Gonsálvez
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2012-09-13 10:01 UTC (permalink / raw)
  To: Samuel Iglesias Gonsalvez
  Cc: Greg Kroah-Hartman, devel, Jens Taprogge, linux-kernel,
	industrypack-devel

On Thu, Sep 13, 2012 at 11:46:26AM +0200, Samuel Iglesias Gonsalvez wrote:
> From: Jens Taprogge <jens.taprogge@taprogge.org>
> 
> The field irq currently is identical to the slot number.  It does not seem to
> have any real use.  The number is written to hardware in ipoctal but it seems
> the value that is written does not matter.
> 
> Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
> ---
> -	iowrite8(vector, ipoctal->dev->mem_space.address + 1);
> +	iowrite8(1, ipoctal->dev->mem_space.address + 1);

It might be nice to put a /* dummy write */ comment here.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition.
  2012-09-13  9:46 ` [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition Samuel Iglesias Gonsalvez
@ 2012-09-13 10:02   ` Dan Carpenter
  2012-09-13 10:07     ` Samuel Iglesias Gonsálvez
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2012-09-13 10:02 UTC (permalink / raw)
  To: Samuel Iglesias Gonsalvez
  Cc: Greg Kroah-Hartman, devel, linux-kernel, industrypack-devel

On Thu, Sep 13, 2012 at 11:46:27AM +0200, Samuel Iglesias Gonsalvez wrote:
> Clear the BREAK flag from the ISR register.
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>

What are the user visible effects of this bugfix?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition.
  2012-09-13 10:02   ` Dan Carpenter
@ 2012-09-13 10:07     ` Samuel Iglesias Gonsálvez
  0 siblings, 0 replies; 9+ messages in thread
From: Samuel Iglesias Gonsálvez @ 2012-09-13 10:07 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg Kroah-Hartman, devel, linux-kernel, industrypack-devel

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

On Thu, 2012-09-13 at 13:02 +0300, Dan Carpenter wrote:
> On Thu, Sep 13, 2012 at 11:46:27AM +0200, Samuel Iglesias Gonsalvez wrote:
> > Clear the BREAK flag from the ISR register.
> > 
> > Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
> 
> What are the user visible effects of this bugfix?
> 

It clears the BREAK flag in the device and avoid to read wrongly the
same condition later.

I should have described better this commit message. I will sent a second
version editing this commit message.

Thanks,

Sam


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device.
  2012-09-13 10:01   ` Dan Carpenter
@ 2012-09-13 10:33     ` Samuel Iglesias Gonsálvez
  0 siblings, 0 replies; 9+ messages in thread
From: Samuel Iglesias Gonsálvez @ 2012-09-13 10:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, devel, Jens Taprogge, linux-kernel,
	industrypack-devel

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

On Thu, 2012-09-13 at 13:01 +0300, Dan Carpenter wrote:
> On Thu, Sep 13, 2012 at 11:46:26AM +0200, Samuel Iglesias Gonsalvez wrote:
> > From: Jens Taprogge <jens.taprogge@taprogge.org>
> > 
> > The field irq currently is identical to the slot number.  It does not seem to
> > have any real use.  The number is written to hardware in ipoctal but it seems
> > the value that is written does not matter.
> > 
> > Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
> > Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
> > ---
> > -	iowrite8(vector, ipoctal->dev->mem_space.address + 1);
> > +	iowrite8(1, ipoctal->dev->mem_space.address + 1);
> 
> It might be nice to put a /* dummy write */ comment here.
> 

Added! Thanks for the suggestion,

Sam


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-09-13 10:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13  9:46 [PATCH 1/5] Staging: ipack: Add IPACK_INT_SPACE memory space Samuel Iglesias Gonsalvez
2012-09-13  9:46 ` [PATCH 2/5] Staging: ipack: move the responsibility to clear interrupts to the IPack devices Samuel Iglesias Gonsalvez
2012-09-13  9:46 ` [PATCH 3/5] staging: ipack: remove irq field in struct ipack_device Samuel Iglesias Gonsalvez
2012-09-13 10:01   ` Dan Carpenter
2012-09-13 10:33     ` Samuel Iglesias Gonsálvez
2012-09-13  9:46 ` [PATCH 4/5] Staging: ipack/devices/ipoctal: acknowledge BREAK condition Samuel Iglesias Gonsalvez
2012-09-13 10:02   ` Dan Carpenter
2012-09-13 10:07     ` Samuel Iglesias Gonsálvez
2012-09-13  9:46 ` [PATCH 5/5] Staging: ipack/devices/ipoctal: simplify ipoctal_write_tty() Samuel Iglesias Gonsalvez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox