[PATCH v3 24/77] ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro

2015-12-21 Thread Finn Thain
Follow the example of the atari_NCR5380.c core driver and adopt the
NCR5380_dma_xfer_len() hook. Implement NCR5380_dma_xfer_len() for dtc.c
and g_NCR5380.c to take care of the limitations of these cards. Keep the
default for drivers using PSEUDO_DMA.

Eliminate the unused macro LIMIT_TRANSFERSIZE. 

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   32 +---
 drivers/scsi/arm/cumana_1.c  |3 +++
 drivers/scsi/arm/oak.c   |2 ++
 drivers/scsi/atari_NCR5380.c |8 +---
 drivers/scsi/dtc.c   |   14 ++
 drivers/scsi/dtc.h   |3 +++
 drivers/scsi/g_NCR5380.c |   15 +++
 drivers/scsi/g_NCR5380.h |3 +++
 drivers/scsi/mac_scsi.c  |1 +
 drivers/scsi/pas16.h |2 ++
 drivers/scsi/t128.h  |2 ++
 11 files changed, 55 insertions(+), 30 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:04.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:07.0 +1100
@@ -201,11 +201,6 @@
  * DONT_USE_INTR - if defined, never use interrupts, even if we probe or
  *  override-configure an IRQ.
  *
- * LIMIT_TRANSFERSIZE - if defined, limit the pseudo-dma transfers to 512
- *  bytes at a time.  Since interrupts are disabled by default during
- *  these transfers, we might need this to give reasonable interrupt
- *  service time if the transfer size gets too large.
- *
  * LINKED - if defined, linked commands are supported.
  *
  * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases.
@@ -2000,29 +1995,12 @@ static void NCR5380_information_transfer
 */
 
 #if defined(PSEUDO_DMA) || defined(REAL_DMA_POLL)
-   /* KLL
-* PSEUDO_DMA is defined here. If this is the 
g_NCR5380
-* driver then it will always be defined, so the
-* FLAG_NO_PSEUDO_DMA is used to inhibit PDMA 
in the base
-* NCR5380 case.  I think this is a fairly 
clean solution.
-* We supplement these 2 if's with the flag.
-*/
-#ifdef NCR5380_dma_xfer_len
-   if (!cmd->device->borken && !(hostdata->flags & 
FLAG_NO_PSEUDO_DMA) && (transfersize = NCR5380_dma_xfer_len(instance, cmd)) != 
0) {
-#else
-   transfersize = cmd->transfersize;
+   transfersize = 0;
+   if (!cmd->device->borken &&
+   !(hostdata->flags & FLAG_NO_PSEUDO_DMA))
+   transfersize = 
NCR5380_dma_xfer_len(instance, cmd, phase);
 
-#ifdef LIMIT_TRANSFERSIZE  /* If we have problems with interrupt service */
-   if (transfersize > 512)
-   transfersize = 512;
-#endif /* LIMIT_TRANSFERSIZE */
-
-   if (!cmd->device->borken && transfersize && 
!(hostdata->flags & FLAG_NO_PSEUDO_DMA) && cmd->SCp.this_residual && 
!(cmd->SCp.this_residual % transfersize)) {
-   /* Limit transfers to 32K, for xx400 & 
xx406
-* pseudoDMA that transfers in 128 
bytes blocks. */
-   if (transfersize > 32 * 1024)
-   transfersize = 32 * 1024;
-#endif
+   if (transfersize) {
len = transfersize;
if (NCR5380_transfer_dma(instance, 
, , (unsigned char **) >SCp.ptr)) {
/*
Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:16:04.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:16:07.0 +1100
@@ -2170,11 +2170,13 @@ static void NCR5380_information_transfer
 */
 
 #if defined(REAL_DMA)
-   if (
 #if !defined(CONFIG_SUN3)
-   !cmd->device->borken &&
+   transfersize = 0;
+   if (!cmd->device->borken)
 #endif
-   (transfersize = 
NCR5380_dma_xfer_len(instance, cmd, phase)) >= DMA_MIN_SIZE) {
+   transfersize = 
NCR5380_dma_xfer_len(instance, cmd, phase);
+
+   if (transfersize >= DMA_MIN_SIZE) {
len = transfersize;
  

[PATCH v3 71/77] ncr5380: Cleanup whitespace and parentheses

2015-12-21 Thread Finn Thain
Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   30 +++---
 drivers/scsi/atari_NCR5380.c |   26 +-
 2 files changed, 32 insertions(+), 24 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:17:23.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:17:26.0 +1100
@@ -1113,7 +1113,7 @@ static struct scsi_cmnd *NCR5380_select(
 * the host and target ID's on the SCSI bus.
 */
 
-   NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << 
scmd_id(cmd;
+   NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask | (1 << scmd_id(cmd)));
 
/*
 * Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1121,7 +1121,8 @@ static struct scsi_cmnd *NCR5380_select(
 * phase immediately after selection.
 */
 
-   NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_BSY | 
ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL));
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_SEL);
NCR5380_write(MODE_REG, MR_BASE);
 
/*
@@ -1139,7 +1140,8 @@ static struct scsi_cmnd *NCR5380_select(
udelay(1);/* wingel -- wait two bus deskew delay >2*45ns */
 
/* Reset BSY */
-   NCR5380_write(INITIATOR_COMMAND_REG, (ICR_BASE | ICR_ASSERT_DATA | 
ICR_ASSERT_ATN | ICR_ASSERT_SEL));
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA |
+ ICR_ASSERT_ATN | ICR_ASSERT_SEL);
 
/*
 * Something weird happens when we cease to drive BSY - looks
@@ -1249,7 +1251,7 @@ static struct scsi_cmnd *NCR5380_select(
/* XXX need to handle errors here */
 
hostdata->connected = cmd;
-   hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
+   hostdata->busy[cmd->device->id] |= 1 << cmd->device->lun;
 
initialize_SCp(cmd);
 
@@ -1340,11 +1342,14 @@ static int NCR5380_transfer_pio(struct S
if (!((p & SR_MSG) && c > 1)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_DATA);
NCR5380_dprint(NDEBUG_PIO, instance);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_DATA | ICR_ASSERT_ACK);
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ACK);
} else {
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_DATA | ICR_ASSERT_ATN);
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN);
NCR5380_dprint(NDEBUG_PIO, instance);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_DATA | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_DATA | ICR_ASSERT_ATN 
| ICR_ASSERT_ACK);
}
} else {
NCR5380_dprint(NDEBUG_PIO, instance);
@@ -1775,10 +1780,12 @@ static void NCR5380_information_transfer
if (sink && (phase != PHASE_MSGOUT)) {
NCR5380_write(TARGET_COMMAND_REG, 
PHASE_SR_TO_TCR(tmp));
 
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_ATN | ICR_ASSERT_ACK);
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_ATN |
+ ICR_ASSERT_ACK);
while (NCR5380_read(STATUS_REG) & SR_REQ)
;
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 
ICR_ASSERT_ATN);
+   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
+ ICR_ASSERT_ATN);
sink = 0;
continue;
}
@@ -1848,8 +1855,9 @@ static void NCR5380_information_transfer
 #endif /* defined(PSEUDO_DMA) || 
defined(REAL_DMA_POLL) */
{
spin_unlock_irq(>lock);
-   NCR5380_transfer_pio(instance, , 
(int *) >SCp.this_residual, (unsigned char **)
->SCp.ptr);
+   NCR5380_transfer_pio(instance, ,
+

[PATCH v3 77/77] ncr5380: Add support for HP C2502

2015-12-21 Thread Finn Thain
From: Ondrej Zary 

HP C2502 cards (based on 53C400A chips) use different magic numbers for
software-based I/O address configuration than other cards.
The configuration is also extended to allow setting the IRQ.

Move the configuration to a new function magic_configure() and move
magic the magic numbers into an array. Add new magic numbers for these
HP cards and hp_c2502 module parameter to use them, e.g.:
modprobe g_NCR5380 ncr_irq=7 ncr_addr=0x280 hp_c2502=1

Tested with HP C2502 and DTCT-436P.

Signed-off-by: Ondrej Zary 
Signed-off-by: Finn Thain 

---

Changes to Ondrej's versions:
- Omit a redundant comment.
- Throw an error if MMIO register locations are not known.
- Avoid 'if (...) { ... continue; } else { ... }'
- Fix "warning: 'port_idx' may be used uninitialized" and
  "warning: 'magic' may be used uninitialized" for port-mapped config.
- Rebased.

---
 drivers/scsi/g_NCR5380.c |   74 ---
 drivers/scsi/g_NCR5380.h |1 
 2 files changed, 59 insertions(+), 16 deletions(-)

Index: linux/drivers/scsi/g_NCR5380.c
===
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-22 12:17:32.0 +1100
+++ linux/drivers/scsi/g_NCR5380.c  2015-12-22 12:17:33.0 +1100
@@ -80,6 +80,7 @@ static int ncr_5380;
 static int ncr_53c400;
 static int ncr_53c400a;
 static int dtc_3181e;
+static int hp_c2502;
 
 static struct override {
NCR5380_map_type NCR5380_map_name;
@@ -225,6 +226,30 @@ static int __init do_DTC3181E_setup(char
 
 #endif
 
+#ifndef SCSI_G_NCR5380_MEM
+/*
+ * Configure I/O address of 53C400A or DTC436 by writing magic numbers
+ * to ports 0x779 and 0x379.
+ */
+static void magic_configure(int idx, u8 irq, u8 magic[])
+{
+   u8 cfg = 0;
+
+   outb(magic[0], 0x779);
+   outb(magic[1], 0x379);
+   outb(magic[2], 0x379);
+   outb(magic[3], 0x379);
+   outb(magic[4], 0x379);
+
+   /* allowed IRQs for HP C2502 */
+   if (irq != 2 && irq != 3 && irq != 4 && irq != 5 && irq != 7)
+   irq = 0;
+   if (idx >= 0 && idx <= 7)
+   cfg = 0x80 | idx | (irq << 4);
+   outb(cfg, 0x379);
+}
+#endif
+
 /**
  * generic_NCR5380_detect  -   look for NCR5380 controllers
  * @tpnt: the scsi template
@@ -241,8 +266,10 @@ static int __init generic_NCR5380_detect
static int current_override;
int count;
unsigned int *ports;
+   u8 *magic = NULL;
 #ifndef SCSI_G_NCR5380_MEM
int i;
+   int port_idx = -1;
unsigned long region_size = 16;
 #endif
static unsigned int __initdata ncr_53c400a_ports[] = {
@@ -251,6 +278,12 @@ static int __init generic_NCR5380_detect
static unsigned int __initdata dtc_3181e_ports[] = {
0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
};
+   static u8 ncr_53c400a_magic[] __initdata = {/* 53C400A & DTC436 */
+   0x59, 0xb9, 0xc5, 0xae, 0xa6
+   };
+   static u8 hp_c2502_magic[] __initdata = {   /* HP C2502 */
+   0x0f, 0x22, 0xf0, 0x20, 0x80
+   };
int flags;
struct Scsi_Host *instance;
struct NCR5380_hostdata *hostdata;
@@ -273,6 +306,8 @@ static int __init generic_NCR5380_detect
overrides[0].board = BOARD_NCR53C400A;
else if (dtc_3181e)
overrides[0].board = BOARD_DTC3181E;
+   else if (hp_c2502)
+   overrides[0].board = BOARD_HP_C2502;
 #ifndef SCSI_G_NCR5380_MEM
if (!current_override && isapnp_present()) {
struct pnp_dev *dev = NULL;
@@ -325,24 +360,26 @@ static int __init generic_NCR5380_detect
case BOARD_NCR53C400A:
flags = FLAG_NO_DMA_FIXUP;
ports = ncr_53c400a_ports;
+   magic = ncr_53c400a_magic;
+   break;
+   case BOARD_HP_C2502:
+   flags = FLAG_NO_DMA_FIXUP;
+   ports = ncr_53c400a_ports;
+   magic = hp_c2502_magic;
break;
case BOARD_DTC3181E:
flags = FLAG_NO_DMA_FIXUP;
ports = dtc_3181e_ports;
+   magic = ncr_53c400a_magic;
break;
}
 
 #ifndef SCSI_G_NCR5380_MEM
-   if (ports) {
+   if (ports && magic) {
/* wakeup sequence for the NCR53C400A and DTC3181E */
 
/* Disable the adapter and look for a free io port */
-   outb(0x59, 0x779);
-   outb(0xb9, 0x379);
-   outb(0xc5, 0x379);
-   outb(0xae, 0x379);
-   outb(0xa6, 0x379);
-   outb(0x00, 0x379);
+   magic_configure(-1, 0, magic);
 
if 

[PATCH v3 23/77] ncr5380: Always retry arbitration and selection

2015-12-21 Thread Finn Thain
If NCR5380_select() returns -1, it means arbitration was lost or selection
failed and should be retried. If the main loop simply terminates when there
are still commands on the issue queue, they will remain queued until they
expire.

Fix this by clearing the 'done' flag after selection failure or lost
arbitration.

The "else break" clause in NCR5380_main() that gets removed here appears
to be a vestige of a long-gone loop that iterated over host instances.
See commit 491447e1fcff ("[PATCH] next NCR5380 updates") in
history/history.git.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |3 +--
 drivers/scsi/atari_NCR5380.c |1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:02.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:04.0 +1100
@@ -1052,8 +1052,7 @@ static void NCR5380_main(struct work_str
NCR5380_information_transfer(instance);
dprintk(NDEBUG_MAIN, "scsi%d : main() : done set 
false\n", instance->host_no);
done = 0;
-   } else
-   break;
+   }
} while (!done);

spin_unlock_irq(instance->host_lock);
Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:16:02.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:16:04.0 +1100
@@ -1181,6 +1181,7 @@ static void NCR5380_main(struct work_str
 #endif
hostdata->retain_dma_intr--;
local_irq_restore(flags);
+   done = 0;
dprintk(NDEBUG_MAIN, "scsi%d: 
main(): select() failed, "
"returned to 
issue_queue\n", HOSTNO);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 62/77] ncr5380: Implement new eh_bus_reset_handler

2015-12-21 Thread Finn Thain
NCR5380.c lacks a sane eh_bus_reset_handler. The atari_NCR5380.c code is
much better but it should not throw out the issue queue (that would be
a host reset) and it neglects to set the result code for commands that it
throws out. Fix these bugs and keep the two core drivers in sync.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   50 ++-
 drivers/scsi/atari_NCR5380.c |   39 +++--
 2 files changed, 72 insertions(+), 17 deletions(-)

Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:17:07.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:17:09.0 +1100
@@ -2694,11 +2694,12 @@ static int NCR5380_bus_reset(struct scsi
struct NCR5380_hostdata *hostdata = shost_priv(instance);
int i;
unsigned long flags;
+   struct NCR5380_cmd *ncmd;
 
spin_lock_irqsave(>lock, flags);
 
 #if (NDEBUG & NDEBUG_ANY)
-   scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
+   scmd_printk(KERN_INFO, cmd, __func__);
 #endif
NCR5380_dprint(NDEBUG_ANY, instance);
NCR5380_dprint_phase(NDEBUG_ANY, instance);
@@ -2718,27 +2719,32 @@ static int NCR5380_bus_reset(struct scsi
 
hostdata->selecting = NULL;
 
-   if (hostdata->connected)
-   dsprintk(NDEBUG_ABORT, instance, "reset aborted a connected 
command\n");
-   hostdata->connected = NULL;
+   list_for_each_entry(ncmd, >disconnected, list) {
+   struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
+
+   set_host_byte(cmd, DID_RESET);
+   cmd->scsi_done(cmd);
+   }
+
+   list_for_each_entry(ncmd, >autosense, list) {
+   struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
+
+   set_host_byte(cmd, DID_RESET);
+   cmd->scsi_done(cmd);
+   }
+
+   if (hostdata->connected) {
+   set_host_byte(hostdata->connected, DID_RESET);
+   complete_cmd(instance, hostdata->connected);
+   hostdata->connected = NULL;
+   }
 
if (hostdata->sensing) {
+   set_host_byte(hostdata->connected, DID_RESET);
complete_cmd(instance, hostdata->sensing);
hostdata->sensing = NULL;
}
 
-   if (!list_empty(>autosense))
-   dsprintk(NDEBUG_ABORT, instance, "reset aborted autosense 
list\n");
-   INIT_LIST_HEAD(>autosense);
-
-   if (!list_empty(>unissued))
-   dsprintk(NDEBUG_ABORT, instance, "reset aborted unissued 
list\n");
-   INIT_LIST_HEAD(>unissued);
-
-   if (!list_empty(>disconnected))
-   dsprintk(NDEBUG_ABORT, instance, "reset aborted disconnected 
list\n");
-   INIT_LIST_HEAD(>disconnected);
-
 #ifdef SUPPORT_TAGS
free_all_tags(hostdata);
 #endif
@@ -2748,6 +2754,7 @@ static int NCR5380_bus_reset(struct scsi
hostdata->dma_len = 0;
 #endif
 
+   queue_work(hostdata->work_q, >main_task);
maybe_release_dma_irq(instance);
spin_unlock_irqrestore(>lock, flags);
 
Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:17:07.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:17:09.0 +1100
@@ -2482,18 +2482,66 @@ static int NCR5380_bus_reset(struct scsi
 {
struct Scsi_Host *instance = cmd->device->host;
struct NCR5380_hostdata *hostdata = shost_priv(instance);
+   int i;
unsigned long flags;
+   struct NCR5380_cmd *ncmd;
 
spin_lock_irqsave(>lock, flags);
 
 #if (NDEBUG & NDEBUG_ANY)
-   scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
+   scmd_printk(KERN_INFO, cmd, __func__);
 #endif
NCR5380_dprint(NDEBUG_ANY, instance);
NCR5380_dprint_phase(NDEBUG_ANY, instance);
 
do_reset(instance);
 
+   /* reset NCR registers */
+   NCR5380_write(MODE_REG, MR_BASE);
+   NCR5380_write(TARGET_COMMAND_REG, 0);
+   NCR5380_write(SELECT_ENABLE_REG, 0);
+
+   /* After the reset, there are no more connected or disconnected commands
+* and no busy units; so clear the low-level status here to avoid
+* conflicts when the mid-level code tries to wake up the affected
+* commands!
+*/
+
+   hostdata->selecting = NULL;
+
+   list_for_each_entry(ncmd, >disconnected, list) {
+   struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
+
+   set_host_byte(cmd, DID_RESET);
+   cmd->scsi_done(cmd);
+   }
+
+   list_for_each_entry(ncmd, >autosense, list) {
+   struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
+
+   set_host_byte(cmd, DID_RESET);
+   cmd->scsi_done(cmd);
+   }
+
+   if (hostdata->connected) {
+

[PATCH v3 49/77] ncr5380: Remove redundant ICR_ARBITRATION_LOST test and eliminate FLAG_DTC3181E

2015-12-21 Thread Finn Thain
Remove FLAG_DTC3181E. It was used to suppress a final Arbitration Lost
(SEL asserted) test that isn't actually needed. The test was suppressed
because it causes problems for DTC436 and DTC536 chips. It takes place
after the host wins arbitration, so SEL has been asserted. These chips
can't seem to tell whether it was the host or another bus device that
did so.

This questionable final test appears in a flow chart in an early NCR5380
datasheet. It was removed from later documents like the DP5380 datasheet.

By the time this final test takes place, the driver has already tested
the Arbitration Lost bit several times. The first test happens 3 us after
BUS FREE (or longer due to register access delays). The protocol requires
that a device stop signalling within 1.8 us after BUS FREE unless it won
arbitration, in which case it must assert SEL, which is detected 1.2 us
later by the first Arbitration Lost test.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   14 +-
 drivers/scsi/NCR5380.h   |1 -
 drivers/scsi/atari_NCR5380.c |9 -
 drivers/scsi/dmx3191d.c  |2 +-
 drivers/scsi/g_NCR5380.c |2 +-
 5 files changed, 3 insertions(+), 25 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:40.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:45.0 +1100
@@ -528,14 +528,13 @@ static void prepare_info(struct Scsi_Hos
 "base 0x%lx, irq %d, "
 "can_queue %d, cmd_per_lun %d, "
 "sg_tablesize %d, this_id %d, "
-"flags { %s%s%s%s}, "
+"flags { %s%s%s}, "
 "options { %s} ",
 instance->hostt->name, instance->io_port, instance->n_io_port,
 instance->base, instance->irq,
 instance->can_queue, instance->cmd_per_lun,
 instance->sg_tablesize, instance->this_id,
 hostdata->flags & FLAG_NO_DMA_FIXUP  ? "NO_DMA_FIXUP "  : "",
-hostdata->flags & FLAG_DTC3181E  ? "DTC3181E "  : "",
 hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "",
 hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY "  : "",
 #ifdef AUTOPROBE_IRQ
@@ -1159,17 +1158,6 @@ static int NCR5380_select(struct Scsi_Ho
NCR5380_write(INITIATOR_COMMAND_REG,
  ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
 
-   if (!(hostdata->flags & FLAG_DTC3181E) &&
-   /* RvC: DTC3181E has some trouble with this
-*  so we simply removed it. Seems to work with
-*  only Mustek scanner attached
-*/
-   (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
-   NCR5380_write(MODE_REG, MR_BASE);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-   dprintk(NDEBUG_ARBITRATION, "scsi%d : lost arbitration, 
deasserting ICR_ASSERT_SEL\n", instance->host_no);
-   return -1;
-   }
/* 
 * Again, bus clear + bus settle time is 1.2us, however, this is 
 * a minimum so we'll udelay ceil(1.2)
Index: linux/drivers/scsi/NCR5380.h
===
--- linux.orig/drivers/scsi/NCR5380.h   2015-12-22 12:16:37.0 +1100
+++ linux/drivers/scsi/NCR5380.h2015-12-22 12:16:45.0 +1100
@@ -232,7 +232,6 @@
 
 #define FLAG_NO_DMA_FIXUP  1   /* No DMA errata workarounds */
 #define FLAG_NO_PSEUDO_DMA 8   /* Inhibit DMA */
-#define FLAG_DTC3181E  16  /* DTC3181E */
 #define FLAG_LATE_DMA_SETUP32  /* Setup NCR before DMA H/W */
 #define FLAG_TAGGED_QUEUING64  /* as X3T9.2 spelled it */
 #define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:16:44.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:16:45.0 +1100
@@ -1420,15 +1420,6 @@ static int NCR5380_select(struct Scsi_Ho
NCR5380_write(INITIATOR_COMMAND_REG,
  ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
 
-   if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
-   hostdata->connected) {
-   NCR5380_write(MODE_REG, MR_BASE);
-   NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-   dprintk(NDEBUG_ARBITRATION, "scsi%d: lost arbitration, 
deasserting ICR_ASSERT_SEL\n",
-  HOSTNO);
-   return -1;
-   }
-
/*
 * Again, bus clear + bus settle time is 1.2us, however, this is
 * a minimum so we'll udelay ceil(1.2)
Index: 

[PATCH v3 56/77] ncr5380: Remove redundant volatile qualifiers

2015-12-21 Thread Finn Thain
The hostdata struct is now protected by a spin lock so the volatile
qualifiers are redundant. Remove them.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.h   |   12 ++--
 drivers/scsi/atari_NCR5380.c |2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

Index: linux/drivers/scsi/NCR5380.h
===
--- linux.orig/drivers/scsi/NCR5380.h   2015-12-22 12:16:51.0 +1100
+++ linux/drivers/scsi/NCR5380.h2015-12-22 12:16:57.0 +1100
@@ -248,14 +248,14 @@ struct NCR5380_hostdata {
NCR5380_implementation_fields;  /* implementation specific */
struct Scsi_Host *host; /* Host backpointer */
unsigned char id_mask, id_higher_mask;  /* 1 << id, all bits greater */
-   volatile unsigned char busy[8]; /* index = target, bit = lun */
+   unsigned char busy[8];  /* index = target, bit = lun */
 #if defined(REAL_DMA) || defined(REAL_DMA_POLL)
-   volatile int dma_len;   /* requested length of DMA */
+   int dma_len;/* requested length of DMA */
 #endif
-   volatile unsigned char last_message;/* last message OUT */
-   volatile struct scsi_cmnd *connected;   /* currently connected command 
*/
-   volatile struct scsi_cmnd *issue_queue; /* waiting to be issued */
-   volatile struct scsi_cmnd *disconnected_queue;  /* waiting for 
reconnect */
+   unsigned char last_message; /* last message OUT */
+   struct scsi_cmnd *connected;/* currently connected cmnd */
+   struct scsi_cmnd *issue_queue;  /* waiting to be issued */
+   struct scsi_cmnd *disconnected_queue;   /* waiting for reconnect */
spinlock_t lock;/* protects this struct */
int flags;
struct scsi_eh_save ses;
Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:16:56.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:16:57.0 +1100
@@ -1009,7 +1009,7 @@ static void NCR5380_dma_complete(struct
struct NCR5380_hostdata *hostdata = shost_priv(instance);
int transferred;
unsigned char **data;
-   volatile int *count;
+   int *count;
int saved_data = 0, overrun = 0;
unsigned char p;
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 27/77] ncr5380: Add missing lock in eh_abort_handler

2015-12-21 Thread Finn Thain
The host spin lock needs to be acquired by NCR5380_abort() before it calls
NCR5380_select(). This patch doesn't actually fix the EH issues in this
driver but it does avoid this:

BUG: spinlock already unlocked on CPU#0, kworker/u4:1/14
 lock: 0xc0c0f834, .magic: dead4ead, .owner: /-1, .owner_cpu: -1
 CPU: 0 PID: 14 Comm: kworker/u4:1 Not tainted 3.15.5 #5
 Workqueue: scsi_tmf_4 scmd_eh_abort_handler
 Call Trace:
 [ef885d70] [c0008acc] show_stack+0x70/0x1bc (unreliable)
 [ef885db0] [c0492a00] dump_stack+0x84/0x684
 [ef885dc0] [c006f314] spin_dump+0xd0/0xe8
 [ef885dd0] [c006f460] do_raw_spin_unlock+0xd4/0xd8
 [ef885df0] [c0491c8c] _raw_spin_unlock_irq+0x10/0x3c
 [ef885e00] [f381fe3c] NCR5380_select+0x3e4/0x6e8 [dmx3191d]
 [ef885e40] [f382026c] NCR5380_abort+0x12c/0x190 [dmx3191d]
 [ef885e60] [c02fec9c] scmd_eh_abort_handler+0x100/0x460
 [ef885e80] [c0046470] process_one_work+0x16c/0x420
 [ef885ea0] [c0046870] worker_thread+0x14c/0x430
 [ef885ed0] [c004e4f4] kthread+0xd8/0xec
 [ef885f40] [c00124d4] ret_from_kernel_thread+0x5c/0x64

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:12.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:14.0 +1100
@@ -2374,6 +2374,7 @@ static int NCR5380_abort(struct scsi_cmn
 
scmd_printk(KERN_WARNING, cmd, "aborting command\n");
 
+   spin_lock_irq(instance->host_lock);
NCR5380_print_status(instance);
 
dprintk(NDEBUG_ABORT, "scsi%d : abort called\n", instance->host_no);
@@ -2420,6 +2421,7 @@ static int NCR5380_abort(struct scsi_cmn
REMOVE(5, *prev, tmp, tmp->host_scribble);
(*prev) = (struct scsi_cmnd *) tmp->host_scribble;
tmp->host_scribble = NULL;
+   spin_unlock_irq(instance->host_lock);
tmp->result = DID_ABORT << 16;
dprintk(NDEBUG_ABORT, "scsi%d : abort removed command 
from issue queue.\n", instance->host_no);
tmp->scsi_done(tmp);
@@ -2443,6 +2445,7 @@ static int NCR5380_abort(struct scsi_cmn
  */
 
if (hostdata->connected) {
+   spin_unlock_irq(instance->host_lock);
dprintk(NDEBUG_ABORT, "scsi%d : abort failed, command 
connected.\n", instance->host_no);
return FAILED;
}
@@ -2475,8 +2478,10 @@ static int NCR5380_abort(struct scsi_cmn
if (cmd == tmp) {
dprintk(NDEBUG_ABORT, "scsi%d : aborting disconnected 
command.\n", instance->host_no);
 
-   if (NCR5380_select(instance, cmd))
+   if (NCR5380_select(instance, cmd)) {
+   spin_unlock_irq(instance->host_lock);
return FAILED;
+   }
dprintk(NDEBUG_ABORT, "scsi%d : nexus 
reestablished.\n", instance->host_no);
 
do_abort(instance);
@@ -2486,6 +2491,7 @@ static int NCR5380_abort(struct scsi_cmn
REMOVE(5, *prev, tmp, 
tmp->host_scribble);
*prev = (struct scsi_cmnd *) 
tmp->host_scribble;
tmp->host_scribble = NULL;
+   spin_unlock_irq(instance->host_lock);
tmp->result = DID_ABORT << 16;
tmp->scsi_done(tmp);
return SUCCESS;
@@ -2500,6 +2506,7 @@ static int NCR5380_abort(struct scsi_cmn
  * so we won't panic, but we will notify the user in case something really
  * broke.
  */
+   spin_unlock_irq(instance->host_lock);
printk(KERN_WARNING "scsi%d : warning : SCSI command probably completed 
successfully\n"
" before abortion\n", instance->host_no);
return FAILED;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 55/77] ncr5380: Remove LIST and REMOVE macros

2015-12-21 Thread Finn Thain
Printing command pointers can be useful when debugging queues. Other than
that, the LIST and REMOVE macros are just clutter. These macros are
redundant now that NDEBUG_QUEUES causes pointers to be printed, so remove
them.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |   19 ---
 drivers/scsi/atari_NCR5380.c |   32 
 2 files changed, 51 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:54.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:56.0 +1100
@@ -80,14 +80,6 @@
  *  tagged queueing)
  */
 
-#if (NDEBUG & NDEBUG_LISTS)
-#define LIST(x,y) {printk("LINE:%d   Adding %p to %p\n", __LINE__, (void*)(x), 
(void*)(y)); if ((x)==(y)) udelay(5); }
-#define REMOVE(w,x,y,z) {printk("LINE:%d   Removing: %p->%p  %p->%p \n", 
__LINE__, (void*)(w), (void*)(x), (void*)(y), (void*)(z)); if ((x)==(y)) 
udelay(5); }
-#else
-#define LIST(x,y)
-#define REMOVE(w,x,y,z)
-#endif
-
 #ifndef notyet
 #undef REAL_DMA
 #endif
@@ -778,12 +770,10 @@ static int NCR5380_queue_command(struct
 */
 
if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
-   LIST(cmd, hostdata->issue_queue);
cmd->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = cmd;
} else {
for (tmp = (struct scsi_cmnd *) hostdata->issue_queue; 
tmp->host_scribble; tmp = (struct scsi_cmnd *) tmp->host_scribble);
-   LIST(cmd, tmp);
tmp->host_scribble = (unsigned char *) cmd;
}
spin_unlock_irqrestore(>lock, flags);
@@ -835,10 +825,8 @@ static void NCR5380_main(struct work_str
if (!(hostdata->busy[tmp->device->id] &
  (1 << (u8)(tmp->device->lun & 0xff {
if (prev) {
-   REMOVE(prev, 
prev->host_scribble, tmp, tmp->host_scribble);
prev->host_scribble = 
tmp->host_scribble;
} else {
-   REMOVE(-1, 
hostdata->issue_queue, tmp, tmp->host_scribble);
hostdata->issue_queue = (struct 
scsi_cmnd *) tmp->host_scribble;
}
tmp->host_scribble = NULL;
@@ -863,7 +851,6 @@ static void NCR5380_main(struct work_str
/* OK or bad target */
} else {
/* Need to retry */
-   LIST(tmp, 
hostdata->issue_queue);
tmp->host_scribble = (unsigned 
char *) hostdata->issue_queue;
hostdata->issue_queue = tmp;
dsprintk(NDEBUG_MAIN | 
NDEBUG_QUEUES,
@@ -1888,7 +1875,6 @@ static void NCR5380_information_transfer
if ((cmd->cmnd[0] != REQUEST_SENSE) && 
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
scsi_eh_prep_cmnd(cmd, 
>ses, NULL, 0, ~0);
 
-   LIST(cmd, 
hostdata->issue_queue);
cmd->host_scribble = (unsigned 
char *)
hostdata->issue_queue;
hostdata->issue_queue = (struct 
scsi_cmnd *) cmd;
@@ -1925,7 +1911,6 @@ static void NCR5380_information_transfer
case DISCONNECT:{
/* Accept message by clearing 
ACK */

NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-   LIST(cmd, 
hostdata->disconnected_queue);
cmd->host_scribble = (unsigned 
char *)

hostdata->disconnected_queue;
hostdata->connected = NULL;
@@ -2175,10 +2160,8 @@ static void NCR5380_reselect(struct Scsi
 tmp; prev = tmp, tmp = (struct scsi_cmnd *) tmp->host_scribble) {
if ((target_mask == (1 << tmp->device->id)) && (lun == 
(u8)tmp->device->lun)) {
if (prev) {
-   REMOVE(prev, prev->host_scribble, tmp, 
tmp->host_scribble);
prev->host_scribble = tmp->host_scribble;
} else {
-   

[PATCH v3 48/77] atari_NCR5380: Fix queue_size limit

2015-12-21 Thread Finn Thain
When a target reports a QUEUE_FULL condition it causes the driver to
update the 'queue_size' limit with the number of currently allocated tags.
At least, that's what's supposed to happen, according to the comments.
Unfortunately the terms in the assignment are swapped. Fix this and
cleanup some obsolete comments.

Signed-off-by: Finn Thain 

---
 drivers/scsi/atari_NCR5380.c |   14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

Index: linux/drivers/scsi/atari_NCR5380.c
===
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:16:37.0 
+1100
+++ linux/drivers/scsi/atari_NCR5380.c  2015-12-22 12:16:44.0 +1100
@@ -229,9 +229,7 @@ static void do_reset(struct Scsi_Host *)
  * cannot know it in advance :-( We just see a QUEUE_FULL status being
  * returned. So, in this case, the driver internal queue size assumption is
  * reduced to the number of active tags if QUEUE_FULL is returned by the
- * target. The command is returned to the mid-level, but with status changed
- * to BUSY, since --as I've seen-- the mid-level can't handle QUEUE_FULL
- * correctly.
+ * target.
  *
  * We're also not allowed running tagged commands as long as an untagged
  * command is active. And REQUEST SENSE commands after a contingent allegiance
@@ -2152,21 +2150,13 @@ static void NCR5380_information_transfer
 #ifdef SUPPORT_TAGS
cmd_free_tag(cmd);
if (status_byte(cmd->SCp.Status) == 
QUEUE_FULL) {
-   /* Turn a QUEUE FULL status 
into BUSY, I think the
-* mid level cannot handle 
QUEUE FULL :-( (The
-* command is retried after 
BUSY). Also update our
-* queue size to the number of 
currently issued
-* commands now.
-*/
-   /* ++Andreas: the mid level 
code knows about
-  QUEUE_FULL now. */
struct tag_alloc *ta = 
>TagAlloc[scmd_id(cmd)][cmd->device->lun];
dprintk(NDEBUG_TAGS, "scsi%d: 
target %d lun %llu returned "
   "QUEUE_FULL after %d 
commands\n",
   HOSTNO, 
cmd->device->id, cmd->device->lun,
   ta->nr_allocated);
if (ta->queue_size > 
ta->nr_allocated)
-   ta->nr_allocated = 
ta->queue_size;
+   ta->queue_size = 
ta->nr_allocated;
}
 #else
hostdata->busy[cmd->device->id] &= ~(1 
<< cmd->device->lun);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 39/77] ncr5380: Standardize interrupt handling

2015-12-21 Thread Finn Thain
Because interrupt handling is crucial to the core driver(s), all wrapper
drivers need to agree on this code. This patch removes discrepancies.

NCR5380_intr() in NCR5380.c has the following pointless loop that differs
from the code in atari_NCR5380.c.

done = 1;
do {
/* ... */
} while (!done);

The 'done' flag gets cleared when a reconnected command is to be processed
from the work queue. But in NCR5380.c, the flag is also used to cause the
interrupt conditions to be re-examined. Perhaps this was because
NCR5380_reselect() was expected to cause another interrupt, or perhaps
the remaining present interrupt conditions need to be handled after the
NCR5380_reselect() call?

Actually, both possibilities are bogus, as is the loop itself. It seems
have been overlooked in the hit-and-miss removal of scsi host instance
list iteration many years ago; see history/history.git commit 491447e1fcff
("[PATCH] next NCR5380 updates") and commit 69e1a9482e57 ("[PATCH] fix up
NCR5380 private data"). See also my earlier patch, "Always retry
arbitration and selection".

The datasheet says, "IRQ can be reset simply by reading the Reset
Parity/Interrupt Register". So don't treat the chip IRQ like a
level-triggered interrupt. Of the conditions that set the IRQ flag,
some are level-triggered and some are edge-triggered, which means IRQ
itself must be edge-triggered.

Some interrupt conditions are latched and some are not. Before clearing
the chip IRQ flag, clear all state that may cause it to be raised. That
means clearing the DMA Mode and Busy Monitor bits in the Mode Register
and clearing the host ID in the Select Enable register.

Also clean up some printk's and some comments. Keep atari_NCR5380.c and
NCR5380.c in agreement.

Signed-off-by: Finn Thain 

---
 drivers/scsi/NCR5380.c   |  187 +++
 drivers/scsi/atari_NCR5380.c |  156 +--
 drivers/scsi/dtc.c   |8 -
 drivers/scsi/g_NCR5380.c |2 
 4 files changed, 180 insertions(+), 173 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:16:27.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:16:28.0 +1100
@@ -951,85 +951,114 @@ static void NCR5380_main(struct work_str
 #ifndef DONT_USE_INTR
 
 /**
- * NCR5380_intr-   generic NCR5380 irq handler
- * @irq: interrupt number
- * @dev_id: device info
- *
- * Handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
- *  from the disconnected queue, and restarting NCR5380_main() 
- *  as required.
- *
- * Locks: takes the needed instance locks
+ * NCR5380_intr - generic NCR5380 irq handler
+ * @irq: interrupt number
+ * @dev_id: device info
+ *
+ * Handle interrupts, reestablishing I_T_L or I_T_L_Q nexuses
+ * from the disconnected queue, and restarting NCR5380_main()
+ * as required.
+ *
+ * The chip can assert IRQ in any of six different conditions. The IRQ flag
+ * is then cleared by reading the Reset Parity/Interrupt Register (RPIR).
+ * Three of these six conditions are latched in the Bus and Status Register:
+ * - End of DMA (cleared by ending DMA Mode)
+ * - Parity error (cleared by reading RPIR)
+ * - Loss of BSY (cleared by reading RPIR)
+ * Two conditions have flag bits that are not latched:
+ * - Bus phase mismatch (non-maskable in DMA Mode, cleared by ending DMA Mode)
+ * - Bus reset (non-maskable)
+ * The remaining condition has no flag bit at all:
+ * - Selection/reselection
+ *
+ * Hence, establishing the cause(s) of any interrupt is partly guesswork.
+ * In "The DP8490 and DP5380 Comparison Guide", National Semiconductor
+ * claimed that "the design of the [DP8490] interrupt logic ensures
+ * interrupts will not be lost (they can be on the DP5380)."
+ * The L5380/53C80 datasheet from LOGIC Devices has more details.
+ *
+ * Checking for bus reset by reading RST is futile because of interrupt
+ * latency, but a bus reset will reset chip logic. Checking for parity error
+ * is unnecessary because that interrupt is never enabled. A Loss of BSY
+ * condition will clear DMA Mode. We can tell when this occurs because the
+ * the Busy Monitor interrupt is enabled together with DMA Mode.
  */
 
-static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
+static irqreturn_t NCR5380_intr(int irq, void *dev_id)
 {
struct Scsi_Host *instance = dev_id;
-   struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) 
instance->hostdata;
-   int done;
+   struct NCR5380_hostdata *hostdata = shost_priv(instance);
+   int handled = 0;
unsigned char basr;
unsigned long flags;
 
-   dprintk(NDEBUG_INTR, "scsi : NCR5380 irq %d triggered\n",
-   instance->irq);
+   spin_lock_irqsave(instance->host_lock, flags);
+
+   basr = NCR5380_read(BUS_AND_STATUS_REG);
+   

[PATCH v3 01/77] atari_scsi: Fix SCSI host ID setting

2015-12-21 Thread Finn Thain
The NVRAM location of this byte is 16, as documented in
http://toshyp.atari.org/en/004009.html

This was confirmed by Michael Schmitz, by setting the SCSI host ID
under EmuTOS and then checking the value in /proc/driver/nvram and
/dev/nvram under Linux.

Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 

---
 drivers/scsi/atari_scsi.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/scsi/atari_scsi.c
===
--- linux.orig/drivers/scsi/atari_scsi.c2015-12-22 12:14:49.0 
+1100
+++ linux/drivers/scsi/atari_scsi.c 2015-12-22 12:15:21.0 +1100
@@ -880,7 +880,7 @@ static int __init atari_scsi_probe(struc
} else {
/* Test if a host id is set in the NVRam */
if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) {
-   unsigned char b = nvram_read_byte(14);
+   unsigned char b = nvram_read_byte(16);
 
/* Arbitration enabled? (for TOS)
 * If yes, use configured host ID


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 02/77] ncr5380: Remove redundant static variable initializers

2015-12-21 Thread Finn Thain
Signed-off-by: Finn Thain 
Reviewed-by: Hannes Reinecke 

---
 drivers/scsi/NCR5380.c   |2 +-
 drivers/scsi/dtc.c   |4 ++--
 drivers/scsi/g_NCR5380.c |4 ++--
 drivers/scsi/pas16.c |   10 +-
 drivers/scsi/sun3_scsi.c |8 
 drivers/scsi/t128.c  |4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

Index: linux/drivers/scsi/NCR5380.c
===
--- linux.orig/drivers/scsi/NCR5380.c   2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/NCR5380.c2015-12-22 12:15:24.0 +1100
@@ -534,7 +534,7 @@ static void NCR5380_set_timer(struct NCR
 }
 
 
-static int probe_irq __initdata = 0;
+static int probe_irq __initdata;
 
 /**
  * probe_intr  -   helper for IRQ autoprobe
Index: linux/drivers/scsi/dtc.c
===
--- linux.orig/drivers/scsi/dtc.c   2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/dtc.c2015-12-22 12:15:24.0 +1100
@@ -150,7 +150,7 @@ static const struct signature {
 
 static int __init dtc_setup(char *str)
 {
-   static int commandline_current = 0;
+   static int commandline_current;
int i;
int ints[10];
 
@@ -188,7 +188,7 @@ __setup("dtc=", dtc_setup);
 
 static int __init dtc_detect(struct scsi_host_template * tpnt)
 {
-   static int current_override = 0, current_base = 0;
+   static int current_override, current_base;
struct Scsi_Host *instance;
unsigned int addr;
void __iomem *base;
Index: linux/drivers/scsi/g_NCR5380.c
===
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/g_NCR5380.c  2015-12-22 12:15:24.0 +1100
@@ -121,7 +121,7 @@ static struct override {
 
 static void __init internal_setup(int board, char *str, int *ints)
 {
-   static int commandline_current = 0;
+   static int commandline_current;
switch (board) {
case BOARD_NCR5380:
if (ints[0] != 2 && ints[0] != 3) {
@@ -251,7 +251,7 @@ static int __init do_DTC3181E_setup(char
 
 static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
 {
-   static int current_override = 0;
+   static int current_override;
int count;
unsigned int *ports;
 #ifndef SCSI_G_NCR5380_MEM
Index: linux/drivers/scsi/pas16.c
===
--- linux.orig/drivers/scsi/pas16.c 2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/pas16.c  2015-12-22 12:15:24.0 +1100
@@ -87,8 +87,8 @@
 #include "NCR5380.h"
 
 
-static unsigned short pas16_addr = 0;
-static int pas16_irq = 0;
+static unsigned short pas16_addr;
+static int pas16_irq;
  
 
 static const int scsi_irq_translate[] =
@@ -305,7 +305,7 @@ static int __init
 
 static int __init pas16_setup(char *str)
 {
-static int commandline_current = 0;
+   static int commandline_current;
 int i;
 int ints[10];
 
@@ -344,8 +344,8 @@ __setup("pas16=", pas16_setup);
 
 static int __init pas16_detect(struct scsi_host_template *tpnt)
 {
-static int current_override = 0;
-static unsigned short current_base = 0;
+   static int current_override;
+   static unsigned short current_base;
 struct Scsi_Host *instance;
 unsigned short io_port;
 int  count;
Index: linux/drivers/scsi/sun3_scsi.c
===
--- linux.orig/drivers/scsi/sun3_scsi.c 2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/sun3_scsi.c  2015-12-22 12:15:24.0 +1100
@@ -100,10 +100,10 @@ static struct scsi_cmnd *sun3_dma_setup_
 static unsigned char *sun3_scsi_regp;
 static volatile struct sun3_dma_regs *dregs;
 static struct sun3_udc_regs *udc_regs;
-static unsigned char *sun3_dma_orig_addr = NULL;
-static unsigned long sun3_dma_orig_count = 0;
-static int sun3_dma_active = 0;
-static unsigned long last_residual = 0;
+static unsigned char *sun3_dma_orig_addr;
+static unsigned long sun3_dma_orig_count;
+static int sun3_dma_active;
+static unsigned long last_residual;
 static struct Scsi_Host *default_instance;
 
 /*
Index: linux/drivers/scsi/t128.c
===
--- linux.orig/drivers/scsi/t128.c  2015-12-22 12:14:49.0 +1100
+++ linux/drivers/scsi/t128.c   2015-12-22 12:15:24.0 +1100
@@ -126,7 +126,7 @@ static struct signature {
 
 static int __init t128_setup(char *str)
 {
-static int commandline_current = 0;
+   static int commandline_current;
 int i;
 int ints[10];
 
@@ -165,7 +165,7 @@ __setup("t128=", t128_setup);
 
 static int __init t128_detect(struct scsi_host_template *tpnt)
 {
-static int current_override = 0, current_base = 0;
+   static int current_override, current_base;
 struct Scsi_Host 

[GIT PULL] VC4 3D fixes for -next

2015-12-21 Thread Eric Anholt
I've decided to just send this fixes-for-next pull request now, even if
we don't have a patch for the CONFIG_PM_SLEEP build failure reviewed.
If you like my patch for that, I'd be happy to see it applied directly.

The following changes since commit 21de54b3c4d08d2b20e80876c6def0b421dfec2e:

  Merge tag 'drm-vc4-next-2015-12-11' of http://github.com/anholt/linux into 
drm-next (2015-12-15 10:43:27 +1000)

are available in the git repository at:

  http://github.com/anholt/linux tags/drm-vc4-next-2015-12-21

for you to fetch changes up to 5645e785cea2f33acdc5e5cee62b3ce8a00f1169:

  drm/vc4: fix an error code (2015-12-17 11:40:30 -0800)


This pull request brings in little fixes from Dan Carpenter for the 3D
support added in this -next cycle.


Dan Carpenter (3):
  drm/vc4: copy_to_user() returns the number of bytes remaining
  drm/vc4: allocate enough memory in vc4_save_hang_state()
  drm/vc4: fix an error code

 drivers/gpu/drm/vc4/vc4_gem.c | 41 -
 1 file changed, 20 insertions(+), 21 deletions(-)


signature.asc
Description: PGP signature


Re: [RFC] free_pages stuff

2015-12-21 Thread Al Viro
On Mon, Dec 21, 2015 at 05:16:44PM -0800, Linus Torvalds wrote:
> On Dec 21, 2015 17:04, "Al Viro"  wrote:
> >
> > > And quite frankly, even the "new name" is likely a bad idea. If you
> > > want to allocate a page, and get a pointer, just use "kmalloc()".
> > > Boom, done!
> >
> > Erm...  You've just described the absolute majority of callers.  Really.
> 
> That wasn't my point.
> 
> I totally believe that most of the legacy users actually wanted a pointer.
> 
> But that doesn't mean that we should just convert a legacy interface. We
> should either just create a new interface and leave old users alone, or if
> we care about that code and really want to remove the cast, maybe it should
> just use kmalloc() instead.
> 
> Long ago, allocating a page using kmalloc() was a bad idea, because there
> was overhead for it in the allocation and the code.
> 
> These days, kmalloc() not only doesn't have the allocation overhead, but
> may actually scale better too, thanks to percpu caches etc.
> 
> So my point here is that not only is it wrong to change the calling
> convention for a legacy function (and it really probably doesn't get much
> more legacy than get_free_page - I think it's been around forever), but

Yes - present in v0.01, with similar situation re callers even back then ;-)

> even the "let's make up a new name" conversion may be wrong, because it's
> entirely possible that the code in question should just be using kmalloc().
> 
> So I don't think an automatic conversion is a good idea. I suspect that old
> code that somebody isn't actively working on should just be left alone, and
> code that *is* actively worked on should maybe consider kmalloc().

Agreed.  Again, what I really wanted was to get the clear picture of what
uses _are_ there.  In more details than just "grepping seems to indicate
that...".  It's really pretty much all of them.

> And if the code really explicitly wants a page (or set of aligned pages)
> for some vm reason, I suspect having the cast there isn't a bad thing. It's
> clearly not just a random pointer allocation if the bit pattern of the
> pointer matters.

BTW, I'm not sure we don't have code that would assume that
kmalloc(PAGE_SIZE,...) always returns something PAGE_SIZE-aligned.

FWIW, pointer-returning get_free_page() would not be a flagday change at
all - we only have __get_free_page()/__get_free_pages() right now.  And I'm
not sure that it wouldn't make sense to add void *-returning variants without
underscores - not for bulk conversion of existing callers, but for new
places that want a page.  Because most of the new ones (and new ones keep
appearing; it's not just ancient code) still want a pointer.  And yes, quite
a few of those should be using something else.

Example (went into the tree just three months ago):
static inline void *scif_zalloc(size_t size)
{
void *ret = NULL;
size_t align = ALIGN(size, PAGE_SIZE);

if (align && get_order(align) < MAX_ORDER)
ret = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
   get_order(align));
return ret ? ret : vzalloc(align);
}

This clearly should be using kzalloc() instead of __get_free_pages() (and
I'm not sure whether the cutoff is right - similar "kmalloc if not too
large, vmalloc otherwise" tends to have cutoff lower than MAX_ORDER;
PAGE_ALLOC_COSTLY_ORDER is more common).  The callers do not look like
they would care about page alignment - at least quite a few of them do
not.

Incidentally, those caller include the following example of lousy naming:
(*pages)->phys_addr = scif_zalloc(nr_pages * sizeof(dma_addr_t));
First of all, the address is clearly virtual - it's an array!  What's more,
I really wonder whether it's DMA or physical addresses that are stored there.
It's declared as an array of dma_addr_t, but...
(*pages)->phys_addr[i] =
__scif_off_to_dma_addr(window, offset +
   (i * PAGE_SIZE));
(*pages)->phys_addr[i] = scif_get_phys((*pages)->phys_addr[i],
ep);
and
static phys_addr_t scif_get_phys(phys_addr_t phys, struct scif_endpt *ep)
seems to indicate something fishy going on.

Typechecking for different kinds of addresses is really too weak, and the
amount of casts we have around them doesn't help either ;-/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] null_blk: fix use-after-free error

2015-12-21 Thread Ming Lei
On Tue, Dec 15, 2015 at 5:56 PM, Mike Krinkin  wrote:
> blk_end_request_all may free request, so we need to save
> request_queue pointer before blk_end_request_all call.
>
> The problem was introduced in commit cf8ecc5a8455266f8d51
> ("null_blk: guarantee device restart in all irq modes")
> and causes general protection fault with slab poisoning
> enabled.
>
> Fixes: cf8ecc5a8455266f8d51 ("null_blk: guarantee device
>restart in all irq modes")
>
> Signed-off-by: Mike Krinkin 

Reviewed-by: Ming Lei 

> ---
>  drivers/block/null_blk.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index 36c4651..6a06e3e 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -219,6 +219,9 @@ static void end_cmd(struct nullb_cmd *cmd)
>  {
> struct request_queue *q = NULL;
>
> +   if (cmd->rq)
> +   q = cmd->rq->q;
> +
> switch (queue_mode)  {
> case NULL_Q_MQ:
> blk_mq_end_request(cmd->rq, 0);
> @@ -232,9 +235,6 @@ static void end_cmd(struct nullb_cmd *cmd)
> goto free_cmd;
> }
>
> -   if (cmd->rq)
> -   q = cmd->rq->q;
> -
> /* Restart queue if needed, as we are freeing a tag */
> if (q && !q->mq_ops && blk_queue_stopped(q)) {
> unsigned long flags;
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [REGRESSION] tcp/ipv4: kernel panic because of (possible) division by zero

2015-12-21 Thread Yuchung Cheng
On Mon, Dec 21, 2015 at 12:25 PM, Oleksandr Natalenko
 wrote:
> Commit 3759824da87b30ce7a35b4873b62b0ba38905ef5 (tcp: PRR uses CRB mode by
> default and SS mode conditionally) introduced changes to net/ipv4/tcp_input.c
> tcp_cwnd_reduction() that, possibly, cause division by zero, and therefore,
> kernel panic in interrupt handler [1].
>
> Reverting 3759824da87b30ce7a35b4873b62b0ba38905ef5 seems to fix the issue.
>
> I'm able to reproduce the issue on 4.3.0–4.3.3 once per several day
> (occasionally).
>
> What could be done to help in debugging this issue?
Do you have ECN enabled (i.e. sysctl net.ipv4.tcp_ecn > 0)?

If so I suspect an ACK carrying ECE during CA_Loss causes entering CWR
state w/o calling tcp_init_cwnd_reduct() to set tp->prior_cwnd. Can
you try this debug / quick-fix patch and send me the error message if
any?


>
> Regards,
>   Oleksandr.
>
> [1] http://i.piccy.info/
> i9/6f5cb187c4ff282d189f78c63f95af43/1450729403/283985/951663/panic.jpg


0001-tcp-debug-tcp_cwnd_reduction-div0.patch
Description: Binary data


[PATCH] drm/vc4: Remove broken attempt at GPU reset using genpd.

2015-12-21 Thread Eric Anholt
I've tested and confirmed that it doesn't actually work.  We'll need
to sort out how to do this properly later, but for now just remove it
since it also caused build breakage due to using CONFIG_PM_SLEEP
functions without our Kconfig depending on PM_SLEEP.

Signed-off-by: Eric Anholt 
---
 drivers/gpu/drm/vc4/vc4_v3d.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 424d515..314ff71 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -144,19 +144,16 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void 
*unused)
 }
 #endif /* CONFIG_DEBUG_FS */
 
-/*
- * Asks the firmware to turn on power to the V3D engine.
- *
- * This may be doable with just the clocks interface, though this
- * packet does some other register setup from the firmware, too.
- */
 int
 vc4_v3d_set_power(struct vc4_dev *vc4, bool on)
 {
-   if (on)
-   return pm_generic_poweroff(>v3d->pdev->dev);
-   else
-   return pm_generic_resume(>v3d->pdev->dev);
+   /* XXX: This interface is needed for GPU reset, and the way to
+* do it is to turn our power domain off and back on.  We
+* can't just reset from within the driver, because the reset
+* bits are in the power domain's register area, and get set
+* during the poweron process.
+*/
+   return 0;
 }
 
 static void vc4_v3d_init_hw(struct drm_device *dev)
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v1 2/2] dt-bindings: sound: add devicetree document for rt5616

2015-12-21 Thread Bard Liao

> -Original Message-
> From: Caesar Wang [mailto:w...@rock-chips.com]
> Sent: Monday, December 21, 2015 10:56 PM
> To: broo...@kernel.org; robh...@kernel.org
> Cc: linux-kernel@vger.kernel.org; devicet...@vger.kernel.org;
> alsa-de...@alsa-project.org; Bard Liao; he...@sntech.de; Caesar Wang
> Subject: [PATCH v1 2/2] dt-bindings: sound: add devicetree document for
> rt5616
> 
> Add the description for rt5616 codec.
> 
> Signed-off-by: Caesar Wang 
> 
> ---
> 
> Changes in v1:
> - As Heiko comments, remove the not exist option properties.
> 
>  Documentation/devicetree/bindings/sound/rt5616.txt | 36
> ++
>  1 file changed, 36 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/sound/rt5616.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/rt5616.txt
> b/Documentation/devicetree/bindings/sound/rt5616.txt
> new file mode 100644
> index 000..2030a22
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/rt5616.txt
> @@ -0,0 +1,36 @@
> +RT5616 audio CODEC
> +
> +This device supports I2C only.
> +
> +Required properties:
> +
> +- compatible : "realtek,rt5616".
> +
> +- reg : The I2C address of the device.
> +
> +Pins on the device (for linking into audio routes) for RT5616:
> +
> +  * IN1P
> +  * IN2P
> +  * IN2N
> +  * LOUTL
> +  * LOUTR

These names below seems not defined in rt5616_dapm_widgets.
Where are they from?

> +  * CPN2
> +  * CPP2
> +  * CPN1
> +  * CPP1
> +  * HPO_R
> +  * HPO_L
> +  * ADCDAT1
> +  * DACDAT1
> +  * LRCK1
> +  * BCLK1
> +  * MCLK
> +  * GPIO1
> +
> +Example:
> +
> +rt5616 {
> + compatible = "realtek,rt5616";
> + reg = <0x1b>;
> +};
> --
> 1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] PCI: generic: Refactor code to enable reuse by other drivers.

2015-12-21 Thread David Daney
From: David Daney 

No change in functionality.

Move structure definitions into a separate header file.  Split probe
function in to two parts:

   - a small driver specific probe function (gen_pci_probe)

   - a common probe that can be used by other drivers
 (gen_pci_common_probe)

Signed-off-by: David Daney 
---
 drivers/pci/host/pci-host-generic.c | 53 ---
 drivers/pci/host/pci-host-generic.h | 56 +
 2 files changed, 74 insertions(+), 35 deletions(-)
 create mode 100644 drivers/pci/host/pci-host-generic.h

diff --git a/drivers/pci/host/pci-host-generic.c 
b/drivers/pci/host/pci-host-generic.c
index 5434c90..e83cec7 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -25,33 +25,7 @@
 #include 
 #include 
 
-struct gen_pci_cfg_bus_ops {
-   u32 bus_shift;
-   struct pci_ops ops;
-};
-
-struct gen_pci_cfg_windows {
-   struct resource res;
-   struct resource *bus_range;
-   void __iomem**win;
-
-   struct gen_pci_cfg_bus_ops  *ops;
-};
-
-/*
- * ARM pcibios functions expect the ARM struct pci_sys_data as the PCI
- * sysdata.  Add pci_sys_data as the first element in struct gen_pci so
- * that when we use a gen_pci pointer as sysdata, it is also a pointer to
- * a struct pci_sys_data.
- */
-struct gen_pci {
-#ifdef CONFIG_ARM
-   struct pci_sys_data sys;
-#endif
-   struct pci_host_bridge  host;
-   struct gen_pci_cfg_windows  cfg;
-   struct list_headresources;
-};
+#include "pci-host-generic.h"
 
 static void __iomem *gen_pci_map_cfg_bus_cam(struct pci_bus *bus,
 unsigned int devfn,
@@ -208,19 +182,15 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci 
*pci)
return 0;
 }
 
-static int gen_pci_probe(struct platform_device *pdev)
+int gen_pci_common_probe(struct platform_device *pdev,
+struct gen_pci *pci)
 {
int err;
const char *type;
-   const struct of_device_id *of_id;
struct device *dev = >dev;
struct device_node *np = dev->of_node;
-   struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
struct pci_bus *bus, *child;
 
-   if (!pci)
-   return -ENOMEM;
-
type = of_get_property(np, "device_type", NULL);
if (!type || strcmp(type, "pci")) {
dev_err(dev, "invalid \"device_type\" %s\n", type);
@@ -229,8 +199,6 @@ static int gen_pci_probe(struct platform_device *pdev)
 
of_pci_check_probe_only();
 
-   of_id = of_match_node(gen_pci_of_match, np);
-   pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
pci->host.dev.parent = dev;
INIT_LIST_HEAD(>host.windows);
INIT_LIST_HEAD(>resources);
@@ -273,6 +241,21 @@ static int gen_pci_probe(struct platform_device *pdev)
return 0;
 }
 
+static int gen_pci_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
+   const struct of_device_id *of_id;
+   struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL);
+
+   if (!pci)
+   return -ENOMEM;
+
+   of_id = of_match_node(gen_pci_of_match, dev->of_node);
+   pci->cfg.ops = (struct gen_pci_cfg_bus_ops *)of_id->data;
+
+   return gen_pci_common_probe(pdev, pci);
+}
+
 static struct platform_driver gen_pci_driver = {
.driver = {
.name = "pci-host-generic",
diff --git a/drivers/pci/host/pci-host-generic.h 
b/drivers/pci/host/pci-host-generic.h
new file mode 100644
index 000..089fecb
--- /dev/null
+++ b/drivers/pci/host/pci-host-generic.h
@@ -0,0 +1,56 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ *
+ * Copyright (C) 2014 ARM Limited
+ *
+ * Author: Will Deacon 
+ */
+
+#ifndef _PCI_HOST_GENERIC_H
+#define _PCI_HOST_GENERIC_H
+
+#include 
+#include 
+
+struct gen_pci_cfg_bus_ops {
+   u32 bus_shift;
+   struct pci_ops ops;
+};
+
+struct gen_pci_cfg_windows {
+   struct resource res;
+   struct resource *bus_range;
+   void __iomem**win;
+
+   struct gen_pci_cfg_bus_ops  *ops;
+};
+
+/*
+ * ARM pcibios functions expect the ARM 

[PATCH 0/2] pci: Add host controller driver for Cavium ThunderX PCIe

2015-12-21 Thread David Daney
From: David Daney 

Some Cavium ThunderX processors require quirky access methods for the
config space of the PCIe bridge.

There are two patches:

1) Refactor code in pci-host-generic so that it can more easily be
   used by other drivers.

2) Add the ThunderX PCIe driver, which leverages the code in
   pci-host-generic

David Daney (2):
  PCI: generic: Refactor code to enable reuse by other drivers.
  pci, pcie-thunder-pem: Add PCIe host driver for ThunderX processors.

 .../devicetree/bindings/pci/pcie-thunder-pem.txt   |  43 
 drivers/pci/host/Kconfig   |   6 +
 drivers/pci/host/Makefile  |   1 +
 drivers/pci/host/pci-host-generic.c|  53 ++--
 drivers/pci/host/pci-host-generic.h|  56 
 drivers/pci/host/pcie-thunder-pem.c| 283 +
 6 files changed, 407 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pci/pcie-thunder-pem.txt
 create mode 100644 drivers/pci/host/pci-host-generic.h
 create mode 100644 drivers/pci/host/pcie-thunder-pem.c

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] pci, pcie-thunder-pem: Add PCIe host driver for ThunderX processors.

2015-12-21 Thread David Daney
From: David Daney 

Some Cavium ThunderX processors require quirky access methods for the
config space of the PCIe bridge.  Add a driver to provide these config
space accessor functions.  The pci-host-generic driver code is used to
configure the PCI machinery.

Signed-off-by: David Daney 
---
 .../devicetree/bindings/pci/pcie-thunder-pem.txt   |  43 
 drivers/pci/host/Kconfig   |   6 +
 drivers/pci/host/Makefile  |   1 +
 drivers/pci/host/pcie-thunder-pem.c| 283 +
 4 files changed, 333 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/pcie-thunder-pem.txt
 create mode 100644 drivers/pci/host/pcie-thunder-pem.c

diff --git a/Documentation/devicetree/bindings/pci/pcie-thunder-pem.txt 
b/Documentation/devicetree/bindings/pci/pcie-thunder-pem.txt
new file mode 100644
index 000..66824d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/pcie-thunder-pem.txt
@@ -0,0 +1,43 @@
+* ThunderX PEM PCIe host controller
+
+Firmware-initialized PCIe host controller found on some Cavium
+ThunderX processors.
+
+The properties and their meanings are identical to those described in
+host-heneric-pci.txt except as listed below.
+
+Properties of the host controller node that differ from
+host-heneric-pci.txt:
+
+- compatible : Must be "cavium,pci-host-thunder-pem"
+
+- reg: Two entries: First the configuration space for down
+   stream devices base address and size, as accessed
+   from the parent bus. Second, the register bank of
+   the PEM device PCIe bridge.
+
+Example:
+
+pem2 {
+   compatible = "cavium,pci-host-thunder-pem";
+   device_type = "pci";
+   msi-parent = <>;
+   msi-map = <0  0x1 0x1>;
+   bus-range = <0x8f 0xc7>;
+   #size-cells = <2>;
+   #address-cells = <3>;
+
+   reg = <0x8880 0x8f00 0x0 0x3900>,  /* Configuration space */
+ <0x87e0 0xc200 0x0 0x0001>; /* PEM space */
+   ranges = <0x0100 0x00 0x0002 0x88b0 0x0002 0x00 
0x0001>, /* I/O */
+<0x0300 0x00 0x1000 0x8890 0x1000 0x0f 
0xf000>, /* mem64 */
+<0x4300 0x10 0x 0x88a0 0x 0x10 
0x>, /* mem64-pref */
+<0x0300 0x87e0 0xc2f0 0x87e0 0xc200 0x00 
0x0010>; /* mem64 PEM BAR4 */
+
+   #interrupt-cells = <1>;
+   interrupt-map-mask = <0 0 0 7>;
+   interrupt-map = <0 0 0 1  0 0 0 24 4>, /* INTA */
+   <0 0 0 2  0 0 0 25 4>, /* INTB */
+   <0 0 0 3  0 0 0 26 4>, /* INTC */
+   <0 0 0 4  0 0 0 27 4>; /* INTD */
+};
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index f131ba9..16ed9c3 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -172,4 +172,10 @@ config PCI_HISI
help
  Say Y here if you want PCIe controller support on HiSilicon HIP05 SoC
 
+config PCIE_HOST_THUNDER_PEM
+   bool "Cavium Thunder PCIe controller to off-chip devices"
+   depends on PCI_HOST_GENERIC && ARM64
+   help
+ Say Y here if you want PCIe support for CN88XX Cavium Thunder SoCs.
+
 endmenu
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
index 9d4d3c6..70bfc37 100644
--- a/drivers/pci/host/Makefile
+++ b/drivers/pci/host/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
 obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
 obj-$(CONFIG_PCIE_ALTERA_MSI) += pcie-altera-msi.o
 obj-$(CONFIG_PCI_HISI) += pcie-hisi.o
+obj-$(CONFIG_PCIE_HOST_THUNDER_PEM) += pcie-thunder-pem.o
diff --git a/drivers/pci/host/pcie-thunder-pem.c 
b/drivers/pci/host/pcie-thunder-pem.c
new file mode 100644
index 000..3b2fa52
--- /dev/null
+++ b/drivers/pci/host/pcie-thunder-pem.c
@@ -0,0 +1,283 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ *
+ * Copyright (C) 2015 Cavium, Inc.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pci-host-generic.h"
+
+#define PEM_CFG_WR 0x28
+#define PEM_CFG_RD 0x30
+
+struct thunder_pem_pci {
+   struct gen_pci  gen_pci;
+   u32 ea_entry[3];
+   void __iomem*pem_reg_base;
+};
+
+static int thunder_pem_config_read(struct pci_bus *bus, unsigned int devfn,
+  int where, int size, u32 *val)

Re: [PATCH 2/5] watchdog: Separate and maintain variables based on variable lifetime

2015-12-21 Thread Guenter Roeck

On 12/21/2015 03:36 PM, Tomas Winkler wrote:

On Mon, Dec 21, 2015 at 7:28 PM, Damien Riegel
 wrote:


On Sun, Dec 20, 2015 at 01:05:00PM -0800, Guenter Roeck wrote:

All variables required by the watchdog core to manage a watchdog are
currently stored in struct watchdog_device. The lifetime of those
variables is determined by the watchdog driver. However, the lifetime
of variables used by the watchdog core differs from the lifetime of
struct watchdog_device. To remedy this situation, watchdog drivers
can implement ref and unref callbacks, to be used by the watchdog
core to lock struct watchdog_device in memory.

While this solves the immediate problem, it depends on watchdog drivers
to actually implement the ref/unref callbacks. This is error prone,
often not implemented in the first place, or not implemented correctly.

To solve the problem without requiring driver support, split the variables
in struct watchdog_device into two data structures - one for variables
associated with the watchdog driver, one for variables associated with
the watchdog core. With this approach, the watchdog core can keep track
of its variable lifetime and no longer depends on ref/unref callbacks
in the driver. As a side effect, some of the variables originally in
struct watchdog_driver are now private to the watchdog core and no longer
visible in watchdog drivers.

The 'ref' and 'unref' callbacks in struct watchdog_driver are no longer
used and marked as deprecated.


Two comments below. It's great to see that unbinding a driver no longer
triggers a kernel panic.



Signed-off-by: Guenter Roeck 
---
  Documentation/watchdog/watchdog-kernel-api.txt |  45 +--
  drivers/watchdog/watchdog_core.c   |   2 -
  drivers/watchdog/watchdog_core.h   |  23 ++
  drivers/watchdog/watchdog_dev.c| 377 +
  include/linux/watchdog.h   |  21 +-
  5 files changed, 239 insertions(+), 229 deletions(-)

diff --git a/Documentation/watchdog/watchdog-kernel-api.txt 
b/Documentation/watchdog/watchdog-kernel-api.txt
index 0a37da76acef..3db5092924e5 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.txt
@@ -44,7 +44,6 @@ The watchdog device structure looks like this:

  struct watchdog_device {
   int id;
- struct cdev cdev;
   struct device *dev;
   struct device *parent;
   const struct watchdog_info *info;
@@ -56,7 +55,7 @@ struct watchdog_device {
   struct notifier_block reboot_nb;
   struct notifier_block restart_nb;
   void *driver_data;
- struct mutex lock;
+ void *wdd_data;
   unsigned long status;
   struct list_head deferred;
  };
@@ -66,8 +65,6 @@ It contains following fields:
/dev/watchdog0 cdev (dynamic major, minor 0) as well as the old
/dev/watchdog miscdev. The id is set automatically when calling
watchdog_register_device.
-* cdev: cdev for the dynamic /dev/watchdog device nodes. This
-  field is also populated by watchdog_register_device.
  * dev: device under the watchdog class (created by watchdog_register_device).
  * parent: set this to the parent device (or NULL) before calling
watchdog_register_device.
@@ -89,11 +86,10 @@ It contains following fields:
  * driver_data: a pointer to the drivers private data of a watchdog device.
This data should only be accessed via the watchdog_set_drvdata and
watchdog_get_drvdata routines.
-* lock: Mutex for WatchDog Timer Driver Core internal use only.
+* wdd_data: a pointer to watchdog core internal data.
  * status: this field contains a number of status bits that give extra
information about the status of the device (Like: is the watchdog timer
-  running/active, is the nowayout bit set, is the device opened via
-  the /dev/watchdog interface or not, ...).
+  running/active, or is the nowayout bit set).
  * deferred: entry in wtd_deferred_reg_list which is used to
register early initialized watchdogs.

@@ -110,8 +106,8 @@ struct watchdog_ops {
   int (*set_timeout)(struct watchdog_device *, unsigned int);
   unsigned int (*get_timeleft)(struct watchdog_device *);
   int (*restart)(struct watchdog_device *);
- void (*ref)(struct watchdog_device *);
- void (*unref)(struct watchdog_device *);
+ void (*ref)(struct watchdog_device *) __deprecated;
+ void (*unref)(struct watchdog_device *) __deprecated;
   long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
  };

@@ -120,20 +116,6 @@ driver's operations. This module owner will be used to 
lock the module when
  the watchdog is active. (This to avoid a system crash when you unload the
  module and /dev/watchdog is still open).

-If the watchdog_device struct is dynamically allocated, just locking the module
-is not enough and a driver also needs to define the ref and unref operations to
-ensure the structure holding the watchdog_device does not go away.
-
-The simplest (and usually 

Re: [BUG, bisect, linux-next] do_IRQ: No irq handler for vector

2015-12-21 Thread Jeremiah Mahler
somebody,

On Sat, Dec 19, 2015 at 11:33:44PM -0800, Jeremiah Mahler wrote:
[...]
> I performed a bisect and found that the following patch introduced the bug,
> which is still present in the latest linux-next 20151218+.
> 
>   From 41c7518a5d14543fa4aa1b5b9994ac26b38c0406 Mon Sep 17 00:00:00 2001
>   From: Jiang Liu 
>   Date: Mon, 30 Nov 2015 16:09:29 +0800
>   Subject: [PATCH] x86/irq: Fix a race condition between vector assigning and
>cleanup
>   
[...]

Thank you to whoever yanked this patch.  It is gone from -next 20151221+
and my machine is working again.

-- 
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] free_pages stuff

2015-12-21 Thread Linus Torvalds
[ Grr. Resending because the stupid android gmail app still can't do
text emails ]

On Dec 21, 2015 17:04, "Al Viro"  wrote:
>
> > And quite frankly, even the "new name" is likely a bad idea. If you
> > want to allocate a page, and get a pointer, just use "kmalloc()".
> > Boom, done!
>
> Erm...  You've just described the absolute majority of callers.  Really.

That wasn't my point.

I totally believe that most of the legacy users actually wanted a pointer.

But that doesn't mean that we should just convert a legacy interface.
We should either just create a new interface and leave old users
alone, or if we care about that code and really want to remove the
cast, maybe it should just use kmalloc() instead.

Long ago, allocating a page using kmalloc() was a bad idea, because
there was overhead for it in the allocation and the code.

These days, kmalloc() not only doesn't have the allocation overhead,
but may actually scale better too, thanks to percpu caches etc.

So my point here is that not only is it wrong to change the calling
convention for a legacy function (and it really probably doesn't get
much more legacy than get_free_page - I think it's been around
forever), but even the "let's make up a new name" conversion may be
wrong, because it's entirely possible that the code in question should
just be using kmalloc().

So I don't think an automatic conversion is a good idea. I suspect
that old code that somebody isn't actively working on should just be
left alone, and code that *is* actively worked on should maybe
consider kmalloc().

And if the code really explicitly wants a page (or set of aligned
pages) for some vm reason, I suspect having the cast there isn't a bad
thing. It's clearly not just a random pointer allocation if the bit
pattern of the pointer matters.

And yes, most of the people who used to want "unsigned long" have long
since been converted to take "struct page *" instead, since things
like the VM wants highmem pages etc.  There's a reason why the
historical interface returns "unsigned long": it _used_ to be the
right thing for a lot of code. The fact that there now are more casts
than not are about changing use patterns, but I don't think that means
that we should change the calling convention that has a historical
reason for it.

 Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/6] perf, tools, stat: Abstract stat metrics printing

2015-12-21 Thread Andi Kleen
> > -   fprintf(out, "   ");
> > +   print_metric(ctxp, NULL, NULL, "insn per cycle", 0);
> > }
> > total = 
> > avg_stats(_stalled_cycles_front_stats[ctx][cpu]);
> > total = max(total, 
> > avg_stats(_stalled_cycles_back_stats[ctx][cpu]));
> >  
> > +   out->new_line(ctxp);
> > if (total && avg) {
> > ratio = total / avg;
> > -   fprintf(out, "\n");
> 
> you haven't address my first comment in here 
> http://marc.info/?l=linux-kernel=144662610723134=2

The new_line is always needed because stalled cycles is always printed.

The reason it is always printed is that metric-only needs to see all the
metrics for its column headers. That's why there are else cases
everywhere.


-Andi
-- 
a...@linux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 9/9] MIPS: dts: jz4780/ci20: Add compatible property to "partitions" node

2015-12-21 Thread Ralf Baechle
On Mon, Dec 21, 2015 at 11:33:53AM +0100, Geert Uytterhoeven wrote:
> Date:   Mon, 21 Dec 2015 11:33:53 +0100
> From: Geert Uytterhoeven 
> To: a...@kernel.org, Andrew Lunn , Gregory Clement
>  , Sebastian Hesselbarth
>  , Simon Horman ,
>  Magnus Damm , Ralf Baechle ,
>  Alex Smith 
> Cc: Brian Norris , Rob Herring
>  , devicet...@vger.kernel.org,
>  linux-arm-ker...@lists.infradead.org, linux...@vger.kernel.org,
>  linux-m...@linux-mips.org, linux-...@lists.infradead.org,
>  linux-kernel@vger.kernel.org, Geert Uytterhoeven 
> Subject: [PATCH v2 9/9] MIPS: dts: jz4780/ci20: Add compatible property to
>  "partitions" node
> 
> As of commit e488ca9f8d4f62c2 ("doc: dt: mtd: partitions: add compatible
> property to "partitions" node"), the "partitions" subnode of an SPI
> FLASH device node must have a compatible property. The partitions are no
> longer detected if it is not present.
> 
> Signed-off-by: Geert Uytterhoeven 
> ---
> v2:
>   - New.
> ---
>  arch/mips/boot/dts/ingenic/ci20.dts | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/boot/dts/ingenic/ci20.dts 
> b/arch/mips/boot/dts/ingenic/ci20.dts
> index 782258c0e4fbba8e..1652d8d60b1e4b86 100644
> --- a/arch/mips/boot/dts/ingenic/ci20.dts
> +++ b/arch/mips/boot/dts/ingenic/ci20.dts
> @@ -70,6 +70,7 @@
>   nand-on-flash-bbt;
>  
>   partitions {
> + compatible = "fixed-partitions";
>   #address-cells = <2>;
>   #size-cells = <2>;
>  
> -- 
> 1.9.1

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5] extcon: add Maxim MAX3355 driver

2015-12-21 Thread Chanwoo Choi
On 2015년 12월 21일 20:01, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/21/2015 5:38 AM, Chanwoo Choi wrote:
> 
 This patch depend on GPIOLIB configuration as following:
 I modified it with following diff and applied it.

 diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
 index ba4db7d..3d89e60 100644
 --- a/drivers/extcon/Kconfig
 +++ b/drivers/extcon/Kconfig
 @@ -54,6 +54,7 @@ config EXTCON_MAX14577

config EXTCON_MAX3355
   tristate "Maxim MAX3355 USB OTG EXTCON Support"
 +   depends on GPIOLIB || COMPILE_TEST
>>>
>>> If it won't compile w/o gpiolib, what's the use of COMIPLE_TEST?
>>> And no, it shouldn't depend on gpiolib. It has empty stubs for the case 
>>> of CONFIG_GPIOLIB=n. Obviously something is wrong with the GPIO headers, 
>>> I'll look into it.
>>
>> Yes. When GPIOLIB is disabled, the build issue don't happen.
> 
>What? It surely does happen!

hmm
Sure. you need to check the include/linux/gpio/consumer.h.

Because of build error happen, you miss to include the "linux/gpio/consumer.h"
header file in extcon-max3355.c. Please test it for enough time.

> 
>> because include/linux/gpio/consumer.h implement the dummy function
>> for all gpio functions if CONFIG_GPIOLIB is disabled.
> 
>Linus W. advised to #include this header explicitly -- I'll try and post.

Don't necessary. I already updated it including the 
"include/linux/gpio/consumer.h".

> 
>> For correct operation of max3355, you should add the dependency
>> to the extcon-max3355.c driver. This driver use the GPIO library
>> certainly.
> 
>I disagree. The driver will just cease to load in this case. I don't see 
> why we need such dependency. Only compilation time dependencies should be
> specified, I think.

This driver have to depend on GPIOLIB.
Why are you disagreeing the COMPILE_TEST dependency? It is just compile test
without anything. 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] watchdog: Separate and maintain variables based on variable lifetime

2015-12-21 Thread Guenter Roeck

On 12/21/2015 09:28 AM, Damien Riegel wrote:

On Sun, Dec 20, 2015 at 01:05:00PM -0800, Guenter Roeck wrote:

All variables required by the watchdog core to manage a watchdog are
currently stored in struct watchdog_device. The lifetime of those
variables is determined by the watchdog driver. However, the lifetime
of variables used by the watchdog core differs from the lifetime of
struct watchdog_device. To remedy this situation, watchdog drivers
can implement ref and unref callbacks, to be used by the watchdog
core to lock struct watchdog_device in memory.

While this solves the immediate problem, it depends on watchdog drivers
to actually implement the ref/unref callbacks. This is error prone,
often not implemented in the first place, or not implemented correctly.

To solve the problem without requiring driver support, split the variables
in struct watchdog_device into two data structures - one for variables
associated with the watchdog driver, one for variables associated with
the watchdog core. With this approach, the watchdog core can keep track
of its variable lifetime and no longer depends on ref/unref callbacks
in the driver. As a side effect, some of the variables originally in
struct watchdog_driver are now private to the watchdog core and no longer
visible in watchdog drivers.

The 'ref' and 'unref' callbacks in struct watchdog_driver are no longer
used and marked as deprecated.


Two comments below. It's great to see that unbinding a driver no longer
triggers a kernel panic.


It should not have caused a panic to start with, but the ref/unref functions
for the most part were either not or wrongly implemented. Not really
surprising - it took me a while to understand the problem.

[ ... ]



  /*
+ * struct _watchdog_device - watchdog core internal data


Think it should be /**. Anyway, I find it confusing to have both
_watchdog_device and watchdog_device, but I can't think of a better
name right now.


I renamed the data structure to watchdog_data and moved it into watchdog_dev.c
since it is only used there. No '**', though, because it is not a published
API, but just an internal data structure.

I also renamed the matching variable name to 'wd_data' (from '_wdd').



  static void watchdog_cdev_unregister(struct watchdog_device *wdd)
  {
-   mutex_lock(>lock);
-   set_bit(WDOG_UNREGISTERED, >status);
-   mutex_unlock(>lock);
+   struct _watchdog_device *_wdd = wdd->wdd_data;

-   cdev_del(>cdev);
+   cdev_del(&_wdd->cdev);
if (wdd->id == 0) {
misc_deregister(_miscdev);
-   old_wdd = NULL;
+   _old_wdd = NULL;
}
+
+   if (watchdog_active(wdd))
+   pr_crit("watchdog%d: watchdog still running!\n", wdd->id);


As it is now safe to unbind and rebind a driver, it means that a
watchdog driver probe function can now be called with a running
watchdog. Some drivers handle this situation, but I think that most of
them expect the watchdog to be off at this point.


No semantics change, though, and no change in behavior. Drivers _should_
handle that situation today. Sure, many don't, but that is a different issue.

I'll address handling an already-running watchdog by the watchdog core until
the character device is opened in a separate patch set, but we'll have to have
this series accepted before I re-introduce that. Even with that, it will still
be the driver's responsibility to detect and report that/if a watchdog is
already running.

Thanks,
Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the drm-intel tree with Linus' tree

2015-12-21 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the drm-intel tree got a conflict in:

  drivers/gpu/drm/i915/intel_pm.c

between commit:

  344df9809f45 ("drm/i915/skl: Disable coarse power gating up until F0")

from Linus' tree and commit:

  06e668ac91c9 ("drm/i915: Apply broader WaRsDisableCoarsePowerGating for guc 
also")

from the drm-intel tree.

I fixed it up (I just used the latter version) and can carry the fix as
necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] free_pages stuff

2015-12-21 Thread Al Viro
On Mon, Dec 21, 2015 at 04:03:11PM -0800, Linus Torvalds wrote:

> If you want to have versions of the function that return pointers, you
> had damn well better give them new names. Not use the same name for a
> different function, causing confusion and forcing this kind of crazy
> "change everything at once" flag-day patches, and pain for
> backporting.

*shrug*

Up to you.  I'll cherry-pick the fixes for bugs found in process and leave
the rest alone.
 
> And quite frankly, even the "new name" is likely a bad idea. If you
> want to allocate a page, and get a pointer, just use "kmalloc()".
> Boom, done!

Erm...  You've just described the absolute majority of callers.  Really.
Counting typecasts demonstrates _that_ very clearly.  Any place that
wanted to allocate a page and get a pointer needs a typecast in mainline;
any place that wanted to allocate a page and get a number would need
one after this series.  Similar for freeing something that is a pointer
and is a number respectively.

The total after that series was 70 typecasts added and 1408 removed.  In other
words, "want to allocate a page and get a pointer" outnumbers the "want to
allocate a page and get a number" a _lot_.

Do you really mean that we are overusing __get_free_page() and friends that
much and that we should simply use kmalloc() instead?  I'm not saying that
it's wrong - a lot of places clearly would be fine with kmalloc/kfree.
For something like page table allocations kmalloc() is obviously wrong (and
they also are of "get a pointer" sort), but that's a very small fraction.

> So I don't know how many ways I can say "NO", but I'll not take
> anythign like this. It's *completely* wrong.

OK.  Don't get me wrong - I'm not fond of all-over-the-tree changes either;
I wanted to figure out how the damn thing is actually used and I have found
that.  What (if anything) to do with that is a separate question.

For me the bottom line so far is that we have a lot of places where page
allocator is used and the majority of those uses the result as a pointer.
That, with the calling conventions we have (and had all along), means tons
of boilerplate.  It also means a lot of opportunities to mix physical,
virtual and DMA addresses, since typechecking is completely bypassed by
those typecasts.

If I understood you correctly, in a lot of those cases the answer should've
been "just use kmalloc() and be done with that".  And something like
e.g. debugfs read and write methods of some wireless NIC driver
certainly could use kmalloc(); any concerns about extra overhead are
ridiculous there.  The same goes for e.g. sysfs symlink body generated
when we run into one, etc.  I'm not suggesting to start converting existing
code to kmalloc; that only goes for new code being written, obviously.

PS: in case you've said that "NO" earlier and I'd missed your replies, my
apologies for keeping that up; this is really the first response from you I've
seen on this topic.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support

2015-12-21 Thread Chen, Yu C
Hi Andy,
thanks for your review,

> -Original Message-
> From: Andy Lutomirski [mailto:l...@amacapital.net]
> Sent: Friday, December 18, 2015 1:00 AM
> To: Zheng, Lv
> Cc: Chen, Yu C; Moore, Robert; Wysocki, Rafael J; Brown, Len; Andy
> Lutomirski; Lv Zheng; linux-kernel@vger.kernel.org; Linux ACPI; H. Peter
> Anvin; Borislav Petkov
> Subject: Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support
> 
[cut]
> 
> I think that hpa or Borislav [cc'd] could address the memory map details
> better than I could.  However, this functionality seems strange.
> 
> Are these physical addresses or virtual addresses that are being dumped?  
[Yu] They are  virtual addresses to be dumped.
> In  either case, ISTM that using something iike page_is_ram might be a lot
> simpler.
[Yu] if i understand correctly, this API is used to check if the address is a 
valid 
'kmalloc' style address, but not 'kmap' or 'vmalloc' address, and page_is_ram
might treat the latter as valid address?

thanks,
Yu


Re: bad page state due to PF_ALG socket

2015-12-21 Thread Cong Wang
On Thu, Dec 17, 2015 at 4:58 AM, Dmitry Vyukov  wrote:
> kasan: GPF could be caused by NULL-ptr deref or user memory access
> general protection fault:  [#1] SMP KASAN
> Modules linked in:
> CPU: 3 PID: 7168 Comm: a.out Tainted: GB   4.4.0-rc3+ #151
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> task: 88003712ad00 ti: 8800331d8000 task.ti: 8800331d8000
> RIP: 0010:[]  []
> skcipher_recvmsg+0x82/0x1f10
> RSP: 0018:8800331dfb80  EFLAGS: 00010203
> RAX: dc00 RBX: 88006b98f300 RCX: 00010040
> RDX: 0002 RSI: 8800331dfdc0 RDI: 0016
> RBP: 8800331dfc80 R08: 8800331dfdd0 R09: 000a
> R10: 00010040 R11: 0246 R12: 0006
> R13: 8800331dfdc0 R14: 8800331dfdc0 R15: 00010040
> FS:  02630880(0063) GS:88006cf0() knlGS:
> CS:  0010 DS:  ES:  CR0: 8005003b
> CR2: 00c8200d73b0 CR3: 64c58000 CR4: 06e0
> Stack:
>  88006aba6024 88006ab24520 88006ab24510 88006aba67e0
>  88006aba602c ed000d574cfc  88006ab24518
>  88006aba602d 1000 88006ab24500 88006aba6a48
> Call Trace:
>  [< inline >] sock_recvmsg_nosec net/socket.c:712
>  [] sock_recvmsg+0xaa/0xe0 net/socket.c:720
>  [] SYSC_recvfrom+0x1e4/0x370 net/socket.c:1707
>  [] SyS_recvfrom+0x40/0x50 net/socket.c:1681
>  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185

I think it is probably fixed by:

commit 130ed5d105dde141e7fe60d5440aa53e0a84f13b
Author: tadeusz.st...@intel.com 
Date:   Tue Dec 15 10:46:17 2015 -0800

net: fix uninitialized variable issue
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] irqchip/gic: Only populate set_affinity for the root controller

2015-12-21 Thread kbuild test robot
Hi Jon,

[auto build test ERROR on tip/irq/core]
[also build test ERROR on next-20151221]
[cannot apply to v4.4-rc6]

url:
https://github.com/0day-ci/linux/commits/Jon-Hunter/irqchip-gic-Remove-static-irq_chip-definition-for-eoimode1/20151221-221639
config: arm-realview_defconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/irqchip/irq-gic.c: In function '__gic_init_bases':
>> drivers/irqchip/irq-gic.c:1019:33: error: 'gic_set_affinity' undeclared 
>> (first use in this function)
   gic->chip.irq_set_affinity = gic_set_affinity;
^
   drivers/irqchip/irq-gic.c:1019:33: note: each undeclared identifier is 
reported only once for each function it appears in

vim +/gic_set_affinity +1019 drivers/irqchip/irq-gic.c

  1013  gic->chip = gic_chip;
  1014  gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
  1015  
  1016  /* Initialize irq_chip */
  1017  if (gic_nr == 0) {
  1018  if (IS_ENABLED(CONFIG_SMP))
> 1019  gic->chip.irq_set_affinity = gic_set_affinity;
  1020  
  1021  if (static_key_true(_deactivate)) {
  1022  gic->chip.irq_mask = gic_eoimode1_mask_irq;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 1/2] drivers/pci: make host/pcie-rcar.c explicitly non-modular

2015-12-21 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2_PCIE
drivers/pci/host/Kconfig:   bool "Renesas R-Car PCIe controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Cc: Phil Edworthy 
Acked-by: Phil Edworthy 
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pcie-rcar.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 5c2962646b17..a8ff4a7383e0 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -7,6 +7,8 @@
  *  arch/sh/drivers/pci/ops-sh7786.c
  *  Copyright (C) 2009 - 2011  Paul Mundt
  *
+ * Module Author: Phil Edworthy 
+ *
  * This file is licensed under the terms of the GNU General Public
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
@@ -18,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -921,7 +923,6 @@ static const struct of_device_id rcar_pcie_of_match[] = {
{ .compatible = "renesas,pcie-r8a7795", .data = rcar_pcie_hw_init },
{},
 };
-MODULE_DEVICE_TABLE(of, rcar_pcie_of_match);
 
 static void rcar_pcie_release_of_pci_ranges(struct rcar_pcie *pci)
 {
@@ -1039,8 +1040,4 @@ static struct platform_driver rcar_pcie_driver = {
},
.probe = rcar_pcie_probe,
 };
-module_platform_driver(rcar_pcie_driver);
-
-MODULE_AUTHOR("Phil Edworthy ");
-MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(rcar_pcie_driver);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] drivers/pci: use builtin_platform_driver in renesas

2015-12-21 Thread Paul Gortmaker
These two commits are extracted from what was a larger series[1] of
demodularization in PCI host code that was bool Kconfig.

With the other commits, there was some mixed opinions whether we
should make it explicitly non-modular or move towards making it
functionally working as a tristate in order to reduce the size of
built-in code for multi-platform kernels.

However with the renesas changes, there was no ".remove" and no
"module_exit" code stripped out ; it is just a straight 1:1 mapping
of the modular macros onto what they become in the non-modular case
anyway -- meaning the runtime remains unchanged.

Given that, and the several Ack rec'd, it makes sense to at least
get these two in and out of my queue while we consider what to do
with the other PCI host code drivers that do have some modularity
already coded into them.

Build testing was done on pci/next, using an ARCH=arm allmodconfig
and then explicitly building the files changed in this series.  

Paul.
---

[1] 
https://lkml.kernel.org/r/1449970917-12633-1-git-send-email-paul.gortma...@windriver.com

Cc: Bjorn Helgaas 
Cc: Phil Edworthy 
Cc: Simon Horman 
Cc: Valentine Barshak 
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org

Paul Gortmaker (2):
  drivers/pci: make host/pcie-rcar.c explicitly non-modular
  drivers/pci: make host/pci-rcar-gen2.c explicitly non-modular

 drivers/pci/host/pci-rcar-gen2.c | 12 +++-
 drivers/pci/host/pcie-rcar.c | 11 ---
 2 files changed, 7 insertions(+), 16 deletions(-)

-- 
2.6.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] drivers/pci: make host/pci-rcar-gen2.c explicitly non-modular

2015-12-21 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_RCAR_GEN2
drivers/pci/host/Kconfig:   bool "Renesas R-Car Gen2 Internal PCI 
controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We don't have to disallow a driver unbind, since that is already
done for us in this driver.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Simon Horman 
Acked-by: Simon Horman 
Cc: Bjorn Helgaas 
Cc: Phil Edworthy 
Cc: Valentine Barshak 
Acked-by: Phil Edworthy 
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pci/host/pci-rcar-gen2.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index 9980a4bdae7e..8df9c36458e9 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -4,6 +4,8 @@
  * Copyright (C) 2013 Renesas Solutions Corp.
  * Copyright (C) 2013 Cogent Embedded, Inc.
  *
+ * Module Author: Valentine Barshak 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -14,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -437,8 +438,6 @@ static struct of_device_id rcar_pci_of_match[] = {
{ },
 };
 
-MODULE_DEVICE_TABLE(of, rcar_pci_of_match);
-
 static struct platform_driver rcar_pci_driver = {
.driver = {
.name = "pci-rcar-gen2",
@@ -447,9 +446,4 @@ static struct platform_driver rcar_pci_driver = {
},
.probe = rcar_pci_probe,
 };
-
-module_platform_driver(rcar_pci_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("Renesas R-Car Gen2 internal PCI");
-MODULE_AUTHOR("Valentine Barshak ");
+builtin_platform_driver(rcar_pci_driver);
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/6] soc: rockchip: add reboot mode driver

2015-12-21 Thread kbuild test robot
Hi Andy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.4-rc6 next-20151221]
[cannot apply to rockchip/for-next]

url:
https://github.com/0day-ci/linux/commits/Andy-Yan/misc-add-reboot-mode-driver/20151221-195031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_mode_write':
>> drivers/soc/rockchip/reboot.c:28:1: warning: no return statement in function 
>> returning non-void [-Wreturn-type]
}
^
   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_probe':
   drivers/soc/rockchip/reboot.c:32:26: warning: unused variable 'reboot' 
[-Wunused-variable]
 struct rockchip_reboot *reboot;
 ^

vim +28 drivers/soc/rockchip/reboot.c

12  #include 
13  #include 
14  #include 
15  #include 
16  #include 
17  #include 
18  #include "loader.h"
19  
20  struct regmap *map;
21  u32 offset;
22  
23  static int rockchip_reboot_mode_write(int magic)
24  {
25  pr_info("%s-magic:%x\n", __func__, magic);
26  regmap_write(map, offset, magic);
27  
  > 28  }
29  
30  static int __init rockchip_reboot_probe(struct platform_device *pdev)
31  {
32  struct rockchip_reboot *reboot;
33  int ret;
34  
35  map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
36
"rockchip,regmap");

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] mm, oom: initiallize all new zap_details fields before use

2015-12-21 Thread Sasha Levin
On 12/21/2015 05:24 PM, Andrew Morton wrote:
>>> Should we use c99 initializer instead to make it future-proof?
>> > 
>> > I didn't do that to make these sort of failures obvious. In this case, if 
>> > we would have
>> > used an initializer and it would default to the "wrong" values it would be 
>> > much harder
>> > to find this bug.
>> > 
> If we're to make that approach useful and debuggable we should poison
> the structure at the outset with some well-known and crazy pattern.  Or
> use kasan.

We sort of do. Consider stack garbage as "poison"...

This bug was found using UBSan which complained that a bool suddenly had the
value of '64'.

If we go back to the scenario I've described, and the struct would have been
initialized on declaration, you'd have a much harder time finding it rather
than letting our existing and future tools find it.


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1 2/2] dt-bindings: sound: add devicetree document for rt5616

2015-12-21 Thread Caesar Wang

Hi

在 2015年12月22日 05:15, Frank Rowand 写道:

On 12/21/2015 6:56 AM, Caesar Wang wrote:

Add the description for rt5616 codec.

Signed-off-by: Caesar Wang 

---

Changes in v1:
- As Heiko comments, remove the not exist option properties.

  Documentation/devicetree/bindings/sound/rt5616.txt | 36 ++
  1 file changed, 36 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/sound/rt5616.txt

diff --git a/Documentation/devicetree/bindings/sound/rt5616.txt 
b/Documentation/devicetree/bindings/sound/rt5616.txt
new file mode 100644
index 000..2030a22
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rt5616.txt
@@ -0,0 +1,36 @@
+RT5616 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+- compatible : "realtek,rt5616".
+
+- reg : The I2C address of the device.
+
+Pins on the device (for linking into audio routes) for RT5616:
+
+  * IN1P
+  * IN2P
+  * IN2N
+  * LOUTL
+  * LOUTR
+  * CPN2
+  * CPP2
+  * CPN1
+  * CPP1
+  * HPO_R
+  * HPO_L
+  * ADCDAT1
+  * DACDAT1
+  * LRCK1
+  * BCLK1
+  * MCLK
+  * GPIO1
+
+Example:
+
+rt5616 {

The node name should be rt5616@1b (including the reg value
from the node).


In general, that's right.

Okay, fixed in next version.





+   compatible = "realtek,rt5616";
+   reg = <0x1b>;
+};







--
caesar wang | software engineer | w...@rock-chip.com


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[lkp] [ipv4, ipv6] c5e8d791ca: BUG: unable to handle kernel

2015-12-21 Thread kernel test robot
FYI, we noticed the below changes on

https://github.com/0day-ci/linux 
Geliang-Tang/Bluetooth-use-list_for_each_entry/20151218-234306
commit c5e8d791cacac62eeec48e00a1a14a6a350670f4 ("ipv4, ipv6: use 
list_for_each_entry*")


[6.848404] IPv6: Attempt to override permanent protocol 33
[6.850925] kworker/u2:1 (109) used greatest stack depth: 7240 bytes left
[6.850925] kworker/u2:1 (109) used greatest stack depth: 7240 bytes left
[6.880428] BUG: unable to handle kernel 
[6.880428] BUG: unable to handle kernel NULL pointer dereferenceNULL 
pointer dereference at   (null)
 at   (null)
[6.882213] IP:
[6.882213] IP: [] __list_del_entry+0x88/0x230
 [] __list_del_entry+0x88/0x230
[6.883565] *pdpt =  
[6.883565] *pdpt =  *pde = f000ff53f000ff53 *pde = 
f000ff53f000ff53 

[6.885082] Oops:  [#1] 
[6.885082] Oops:  [#1] SMP SMP 

[6.885926] Modules linked in:
[6.885926] Modules linked in:

[6.886781] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
4.4.0-rc3-00302-gc5e8d79 #1
[6.886781] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
4.4.0-rc3-00302-gc5e8d79 #1
[6.888380] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Debian-1.8.2-1 04/01/2014
[6.888380] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Debian-1.8.2-1 04/01/2014
[6.890387] task: c005a000 ti: c005c000 task.ti: c005c000
[6.890387] task: c005a000 ti: c005c000 task.ti: c005c000
[6.891774] EIP: 0060:[] EFLAGS: 00010246 CPU: 0
[6.891774] EIP: 0060:[] EFLAGS: 00010246 CPU: 0
[6.895311] EIP is at __list_del_entry+0x88/0x230
[6.895311] EIP is at __list_del_entry+0x88/0x230
[6.896639] EAX:  EBX: cab7cd7c ECX:  EDX: 
[6.896639] EAX:  EBX: cab7cd7c ECX:  EDX: 
[6.899728] ESI:  EDI:  EBP: c005deec ESP: c005dec4
[6.899728] ESI:  EDI:  EBP: c005deec ESP: c005dec4
[6.903932]  DS: 007b ES: 007b FS: 00d8 GS:  SS: 0068
[6.903932]  DS: 007b ES: 007b FS: 00d8 GS:  SS: 0068
[6.905123] CR0: 80050033 CR2:  CR3: 0ade1000 CR4: 000406b0
[6.905123] CR0: 80050033 CR2:  CR3: 0ade1000 CR4: 000406b0
[6.909725] Stack:
[6.909725] Stack:
[6.910254]  cab7a080
[6.910254]  cab7a080 d5a87f88 d5a87f88 c005deec c005deec ca6cd52b ca6cd52b 
  0001 0001   cab7cd7c cab7cd7c

[6.913171]  cac4493e
[6.913171]  cac4493e d5a87f88 d5a87f88 c005df00 c005df00 ca590d75 ca590d75 
ca5d25fd ca5d25fd ff9f ff9f ff9f ff9f c005df0c c005df0c

[6.918206]  cac4499f
[6.918206]  cac4499f caad4600 caad4600 c005df84 c005df84 c9c00442 c9c00442 
024000c0 024000c0 ca9b99ac ca9b99ac cac4493e cac4493e 0068 0068

[6.921476] Call Trace:
[6.921476] Call Trace:
[6.922000]  [] ? _raw_spin_lock_bh+0x6b/0x80
[6.922000]  [] ? _raw_spin_lock_bh+0x6b/0x80
[6.924344]  [] ? dccp_v6_init_net+0x30/0x30
[6.924344]  [] ? dccp_v6_init_net+0x30/0x30
[6.925606]  [] inet6_unregister_protosw+0x25/0x60
[6.925606]  [] inet6_unregister_protosw+0x25/0x60
[6.930274]  [] ? inet6_del_protocol+0x2d/0x40
[6.930274]  [] ? inet6_del_protocol+0x2d/0x40
[6.931517]  [] dccp_v6_init+0x61/0x70
[6.931517]  [] dccp_v6_init+0x61/0x70
[6.932670]  [] do_one_initcall+0x82/0x1e0
[6.932670]  [] do_one_initcall+0x82/0x1e0
[6.937242]  [] ? dccp_v6_init_net+0x30/0x30
[6.937242]  [] ? dccp_v6_init_net+0x30/0x30
[6.939877]  [] ? parse_args+0x176/0x440
[6.939877]  [] ? parse_args+0x176/0x440
[6.940919]  [] ? kernel_init_freeable+0xcd/0x16a
[6.940919]  [] ? kernel_init_freeable+0xcd/0x16a
[6.942284]  [] kernel_init_freeable+0xed/0x16a
[6.942284]  [] kernel_init_freeable+0xed/0x16a
[6.946965]  [] kernel_init+0x10/0xe0
[6.946965]  [] kernel_init+0x10/0xe0
[6.948084]  [] ret_from_kernel_thread+0x21/0x38
[6.948084]  [] ret_from_kernel_thread+0x21/0x38
[6.952443]  [] ? rest_init+0xc0/0xc0
[6.952443]  [] ? rest_init+0xc0/0xc0
[6.953426] Code:
[6.953426] Code: 78 78 69 69 bc bc ca ca 89 89 f2 f2 e8 e8 c8 c8 11 11 bb 
bb ff ff 81 81 7d 7d f0 f0 00 00 02 02 00 00 00 00 0f 0f 84 84 6b 6b 01 01 00 
00 00 00 31 31 c9 c9 89 89 f2 f2 b8 b8 64 64 69 69 bc bc ca ca e8 e8 ad ad 11 
11 bb bb ff ff 8b 8b 45 45 f0 f0 31 31 d2 d2 <8b> <8b> 30 30 b8 b8 50 50 69 69 
bc bc ca ca 39 39 f3 f3 0f 0f 95 95 c2 c2 31 31 c9 c9 89 89 55 55 ec ec e8 e8 
92 92 11 11 bb bb

[6.965056] EIP: [] 
[6.965056] EIP: [] 
__list_del_entry+0x88/0x230__list_del_entry+0x88/0x230 SS:ESP 0068:c005dec4
 SS:ESP 0068:c005dec4
[6.970187] CR2: 
[6.970187] CR2: 
[6.970894] ---[ end trace 2c9f823fcf08155b ]---
[6.970894] ---[ end trace 2c9f823fcf08155b ]---





Thanks,
Kernel Test Robot
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 4.4.0-rc3 Kernel Configuration
#
# 

Re: 4.4-rc5 crash (af_unix)

2015-12-21 Thread Cong Wang
(Cc'ing netdev and Rainer)

On Thu, Dec 17, 2015 at 9:12 PM, Mika Penttilä
 wrote:
> Still something with af_unix and/or wake code on rc5 :
>
>
> [34971.300210] Unable to handle kernel paging request at virtual address
> 56ac56ac
>
> [34971.307455] pgd = a8c3
>
> [34971.310164] [56ac56ac] *pgd=
>
> [34971.313761] Internal error: Oops: 8005 [#1] PREEMPT SMP ARM
>
> [34971.319683] Modules linked in: btwilink st_drv
>
> [34971.324174] CPU: 1 PID: 333 Comm: compositor Not tainted 4.4.0-rc5 #1
>
> [34971.330620] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
>
> [34971.337152] task: a8c71c80 ti: a8aea000 task.ti: a8aea000
>
> [34971.342554] PC is at 0x56ac56ac
>
> [34971.345710] LR is at __wake_up_common+0x4c/0x80
>
> [34971.350246] pc : [<56ac56ac>]lr : [<800585e4>]psr: 200f0093
>
> [34971.350246] sp : a8aebd20  ip : a8ea56bc  fp : 0001
>
> [34971.361725] r10: 0001  r9 : 0001  r8 : 0304
>
> [34971.366952] r7 : a8ea5744  r6 : 8023a9e4  r5 : 56ac56ac  r4 : a8c95d28
>
> [34971.373480] r3 : 0304  r2 : 0001  r1 : 0001  r0 : a8ea56bc
>
> [34971.380010] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
> Segment user
>
> [34971.387234] Control: 10c5387d  Table: 38c3004a  DAC: 0055
>
> [34971.392982] Process compositor (pid: 333, stack limit = 0xa8aea210)
>
> [34971.399250] Stack: (0xa8aebd20 to 0xa8aec000)
>
> [34971.403612] bd20: 0001 a8ea5740 0001 0304 0001
> a00f0013 0098 a8aebe4c
>
> [34971.411793] bd40:  80058bc8 0304 a8aebe78 a8db42c0
> a8db42c0 a8db4000 0f68
>
> [34971.419974] bd60: a8db4084 805bd7c0 a8db4394 805196d8 a9e37600
>  a8db4000 805bd270
>
> [34971.428155] bd80: a8aebd94    
>  a9e37600 8051a810
>
> [34971.436336] bda0: a9e37600 8051a970 a9e37600 8051aa44 a9e37600
> 805be498 7ec113e8 8025f2e4
>
> [34971.444517] bdc0: a8f35044 0098 a8db420c 0098 a653e780
> 0001  
>
> [34971.452697] bde0: a8db41e4  a8aebdf8  a8aea000
> 800e4928  
>
> [34971.460878] be00:     7ec115a8
> 80264d8c a8aebe78 a8aebe24
>
> [34971.469059] be20: 00a5cda4 80513658 a8aebf6c 4040 7ec115b8
> 7ec115d4 a8aebeb8 a653e780
>
> [34971.477240] be40: 00c50388 805be604 00c87240 805bd130 a653e780
> a8aebf6c  1000
>
> [34971.485420] be60: 4040  00c50388 8051515c 
>  00c506fc 0c8c
>
> [34971.493601] be80: 00c50388 0374 014d  0004
> 0320 00a70664 00983dcc
>
> [34971.501782] bea0: 758ce8e0 00983dcc 758ce8e0 758ce8ec 00a70664
> 758ce8ec  80513a8c
>
> [34971.509963] bec0: a8b6df8c a8aebf10 a8b6df8c a8aebf10 7ec116d8
> 8011da50 00a70664 
>
> [34971.518143] bee0: 0001 600f0013 a8aebefc 8004559c a8c07500
> 600f0013 a8c07534 806de1a0
>
> [34971.526324] bf00: a8c07534 806de414  8011df1c a8aebf10
> a8aebf10 a8aebf2c 0020
>
> [34971.534505] bf20: a895ccc0 800fd364 a8aebf68 a8aebf64 4040
> 0129 a653e780 7ec115b8
>
> [34971.542686] bf40: 4040 0129 8000f6a4 a8aea000 
> 80515eb0  
>
> [34971.550867] bf60: 0020 0001 fff7  
>  0098 0f68
>
> [34971.559047] bf80: a8aebe78 0002 7ec115d4 007c 4000
>  0040 001c
>
> [34971.567227] bfa0: 7ec115b8 8000f500 0040 001c 001c
> 7ec115b8 4040 
>
> [34971.575409] bfc0: 0040 001c 7ec115b8 0129 0006
> 7ec115b8 76145d68 00c50388
>
> [34971.583589] bfe0:  7ec11588 73d6f4c0 75bef794 800f0010
> 001c 3bf5e861 3bf5ec61
>
> [34971.591782] [<800585e4>] (__wake_up_common) from [<80058bc8>]
> (__wake_up_sync_key+0x44/0x60)
>
> [34971.600235] [<80058bc8>] (__wake_up_sync_key) from [<805bd7c0>]
> (unix_write_space+0x58/0x88)
>
> [34971.608686] [<805bd7c0>] (unix_write_space) from [<805196d8>]
> (sock_wfree+0x78/0x80)
>
> [34971.616437] [<805196d8>] (sock_wfree) from [<805bd270>]
> (unix_destruct_scm+0x64/0x6c)
>
> [34971.624276] [<805bd270>] (unix_destruct_scm) from [<8051a810>]
> (skb_release_head_state+0x84/0xec)
>
> [34971.633154] [<8051a810>] (skb_release_head_state) from [<8051a970>]
> (skb_release_all+0xc/0x24)
>
> [34971.641772] [<8051a970>] (skb_release_all) from [<8051aa44>]
> (consume_skb+0x24/0x60)
>
> [34971.649523] [<8051aa44>] (consume_skb) from [<805be498>]
> (unix_stream_read_generic+0x71c/0x7d0)
>
> [34971.658228] [<805be498>] (unix_stream_read_generic) from [<805be604>]
> (unix_stream_recvmsg+0x38/0x40)
>
> [34971.667453] [<805be604>] (unix_stream_recvmsg) from [<8051515c>]
> (___sys_recvmsg+0x94/0x12c)
>
> [34971.675897] [<8051515c>] (___sys_recvmsg) from [<80515eb0>]
> (__sys_recvmsg+0x3c/0x6c)
>
> [34971.683738] [<80515eb0>] (__sys_recvmsg) from [<8000f500>]
> (ret_fast_syscall+0x0/0x34)
>
> [34971.691659] Code: bad PC value
>
> [34971.694718] ---[ end trace b54a6d4b7a89f212 ]---
>
> [34971.699339] Kernel panic 

linux-next: manual merge of the drm tree with the imx-mxs tree

2015-12-21 Thread Stephen Rothwell
Hi Dave,

Today's linux-next merge of the drm tree got a conflict in:

  Documentation/devicetree/bindings/vendor-prefixes.txt

between commit:

  453bb38ce504 ("devicetree: bindings: Add vendor prefix for Kosagi")

from the imx-mxs tree and commit:

  f42fb5539ab5 ("devicetree: add vendor prefix for Kyocera Corporation")

from the drm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc Documentation/devicetree/bindings/vendor-prefixes.txt
index e4cd78a4c652,b123731b2dca..
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@@ -123,7 -124,7 +124,8 @@@ jedec  JEDEC Solid State Technology Asso
  karo  Ka-Ro electronics GmbH
  keymile   Keymile GmbH
  kinetic Kinetic Technologies
 +kosagiSutajio Ko-Usagi PTE Ltd.
+ kyo   Kyocera Corporation
  lacie LaCie
  lantiqLantiq Semiconductor
  lenovoLenovo Group Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [lustre-devel] [PATCH] staging: lustre: Handle nodemask on UMP machines

2015-12-21 Thread Dilger, Andreas
On 2015/12/21, 15:08, "lustre-devel on behalf of Greg Kroah-Hartman"
 wrote:

>On Sun, Nov 08, 2015 at 11:34:55AM -0500, James Simmons wrote:
>> For UMP and SMP machines the struct cfs_cpt_table are
>> defined differently. In the case handled by this patch
>> nodemask is defined as a integer for the UMP case and
>> as a pointer for the SMP case. This will cause a problem
>> for ost_setup which reads the nodemask directly. Instead
>> we create a UMP version of cfs_cpt_nodemask and use that
>> in ost_setup.
>> 
>> Signed-off-by: James Simmons 
>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199
>> Reviewed-on: http://review.whamcloud.com/9219
>> Reviewed-by: Liang Zhen 
>> Reviewed-by: Li Xi 
>> Reviewed-by: Andreas Dilger 
>> 
>> Starting in 3.14 kernels nodemask_t was changed from a
>> a unsigned long to a linux bitmap so more than 32 cores
>> could be supported. Using set_bit in cfs_cpt_table_alloc
>> no longer compiles so this patch backports bits of the
>> node management function that use a linux bitmap back
>> end. Cleaned up libcfs bitmap.h to use the libcfs layers
>> memory allocation function. This was pulling in lustre
>> related code that was not defined.
>> 
>> Signed-off-by: James Simmons 
>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4993
>> Reviewed-on: http://review.whamcloud.com/10332
>> Reviewed-by: Liang Zhen 
>> Reviewed-by: Bob Glossman 
>> Reviewed-by: Oleg Drokin 
>
>What is with this crazy two sections of signed-off-by?  If this was 2
>patches, make it two patches.
>
>If not, then don't do this.
>
>Also, this whole series had no numbering, so I don't know how to apply
>them, please fix and resend it.

I suspect that this is merging two separate patches so that they do not
introduce a regression when landed to master.  In the past you've said
you wanted fix patches merged into the original patch for this reason.

I guess the right thing to do is to merge the Signed-off-by: lines at
the end of the combined patch, rather than just mashing the commit
messages together.

Cheers, Andreas
-- 
Andreas Dilger

Lustre Principal Architect
Intel High Performance Data Division


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 5/5] misc: eeprom_93xx46: Add support for a GPIO 'select' line.

2015-12-21 Thread Vladimir Zapolskiy
Hi Cory,

On 10.12.2015 06:00, Cory Tusar wrote:
> This commit adds support to the eeprom_93x46 driver allowing a GPIO line
> to function as a 'select' or 'enable' signal prior to accessing the
> EEPROM.
> 
> Signed-off-by: Cory Tusar 
> Tested-by: Chris Healy 
> ---
>  drivers/misc/eeprom/eeprom_93xx46.c | 35 +++
>  include/linux/eeprom_93xx46.h   |  3 +++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/misc/eeprom/eeprom_93xx46.c 
> b/drivers/misc/eeprom/eeprom_93xx46.c
> index d50bc17..d28fac2 100644
> --- a/drivers/misc/eeprom/eeprom_93xx46.c
> +++ b/drivers/misc/eeprom/eeprom_93xx46.c
> @@ -10,11 +10,13 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -343,6 +345,20 @@ static ssize_t eeprom_93xx46_store_erase(struct device 
> *dev,
>  }
>  static DEVICE_ATTR(erase, S_IWUSR, NULL, eeprom_93xx46_store_erase);
>  
> +static void select_assert(void *context)
> +{
> + struct eeprom_93xx46_dev *edev = context;
> +
> + gpiod_set_value_cansleep(edev->pdata->select, 1);
> +}
> +
> +static void select_deassert(void *context)
> +{
> + struct eeprom_93xx46_dev *edev = context;
> +
> + gpiod_set_value_cansleep(edev->pdata->select, 0);
> +}
> +
>  static const struct of_device_id eeprom_93xx46_of_table[] = {
>   { .compatible = "eeprom-93xx46", },
>   { .compatible = "atmel,at93c46d", .data = _at93c46d_data, },
> @@ -357,6 +373,8 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi)
>   struct device_node *np = spi->dev.of_node;
>   struct eeprom_93xx46_platform_data *pd;
>   u32 tmp;
> + int gpio;
> + enum of_gpio_flags of_flags;
>   int ret;
>  
>   pd = devm_kzalloc(>dev, sizeof(*pd), GFP_KERNEL);
> @@ -381,6 +399,23 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi)
>   if (of_property_read_bool(np, "read-only"))
>   pd->flags |= EE_READONLY;
>  
> + gpio = of_get_named_gpio_flags(np, "select-gpios", 0, _flags);
> + if (gpio_is_valid(gpio)) {
> + unsigned long flags =
> + of_flags == OF_GPIO_ACTIVE_LOW ? GPIOF_ACTIVE_LOW : 0;
> +
> + ret = devm_gpio_request_one(>dev, gpio, flags,
> + "eeprom_93xx46_select");
> + if (ret)
> + return ret;
> +
> + pd->select = gpio_to_desc(gpio);
> + pd->prepare = select_assert;
> + pd->finish = select_deassert;
> +
> + gpiod_direction_output(pd->select, 0);
> + }
> +
>   if (of_id->data) {
>   const struct eeprom_93xx46_devtype_data *data = of_id->data;
>  
> diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h
> index 92fa4c3..03f3435 100644
> --- a/include/linux/eeprom_93xx46.h
> +++ b/include/linux/eeprom_93xx46.h
> @@ -3,6 +3,8 @@
>   * platform description for 93xx46 EEPROMs.
>   */
>  
> +#include 
> +

You need just "struct gpio_desc;" instead of the include here, please fix.

>  struct eeprom_93xx46_platform_data {
>   unsigned char   flags;
>  #define EE_ADDR8 0x01/*  8 bit addr. cfg */
> @@ -21,4 +23,5 @@ struct eeprom_93xx46_platform_data {
>*/
>   void (*prepare)(void *);
>   void (*finish)(void *);
> + struct gpio_desc *select;
>  };
> 

Reviewed-by: Vladimir Zapolskiy 

--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/8] cgroup: implement cgroup_get_from_path() and expose cgroup_put()

2015-12-21 Thread Serge E. Hallyn
On Mon, Dec 07, 2015 at 05:38:50PM -0500, Tejun Heo wrote:
> Implement cgroup_get_from_path() using kernfs_walk_and_get() which
> obtains a default hierarchy cgroup from its path.  This will be used
> to allow cgroup path based matching from outside cgroup proper -
> e.g. networking and perf.

Hi Tejun,

I'm trying to figure out how to handle this in the cgroup ns patchset.
Is this going to be purely used internally?  From the user i see in
this patchset it looks like I should leave it be (and have @path always
be absolute)  Is that right?

thanks,
-serge

> v2: Add EXPORT_SYMBOL_GPL(cgroup_get_from_path).
> 
> Signed-off-by: Tejun Heo 
> ---
>  include/linux/cgroup.h |  7 +++
>  kernel/cgroup.c| 39 ++-
>  2 files changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index b5ee2c4..4c3ffab 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -81,6 +81,8 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup 
> *cgroup,
>  struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
>  struct cgroup_subsys 
> *ss);
>  
> +struct cgroup *cgroup_get_from_path(const char *path);
> +
>  int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
>  int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
>  
> @@ -351,6 +353,11 @@ static inline void css_put_many(struct 
> cgroup_subsys_state *css, unsigned int n)
>   percpu_ref_put_many(>refcnt, n);
>  }
>  
> +static inline void cgroup_put(struct cgroup *cgrp)
> +{
> + css_put(>self);
> +}
> +
>  /**
>   * task_css_set_check - obtain a task's css_set with extra access conditions
>   * @task: the task to obtain css_set for
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 3190040..3db5e8f 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -434,11 +434,6 @@ static bool cgroup_tryget(struct cgroup *cgrp)
>   return css_tryget(>self);
>  }
>  
> -static void cgroup_put(struct cgroup *cgrp)
> -{
> - css_put(>self);
> -}
> -
>  struct cgroup_subsys_state *of_css(struct kernfs_open_file *of)
>  {
>   struct cgroup *cgrp = of->kn->parent->priv;
> @@ -5753,6 +5748,40 @@ struct cgroup_subsys_state *css_from_id(int id, struct 
> cgroup_subsys *ss)
>   return id > 0 ? idr_find(>css_idr, id) : NULL;
>  }
>  
> +/**
> + * cgroup_get_from_path - lookup and get a cgroup from its default hierarchy 
> path
> + * @path: path on the default hierarchy
> + *
> + * Find the cgroup at @path on the default hierarchy, increment its
> + * reference count and return it.  Returns pointer to the found cgroup on
> + * success, ERR_PTR(-ENOENT) if @path doens't exist and ERR_PTR(-ENOTDIR)
> + * if @path points to a non-directory.
> + */
> +struct cgroup *cgroup_get_from_path(const char *path)
> +{
> + struct kernfs_node *kn;
> + struct cgroup *cgrp;
> +
> + mutex_lock(_mutex);
> +
> + kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path);
> + if (kn) {
> + if (kernfs_type(kn) == KERNFS_DIR) {
> + cgrp = kn->priv;
> + cgroup_get(cgrp);
> + } else {
> + cgrp = ERR_PTR(-ENOTDIR);
> + }
> + kernfs_put(kn);
> + } else {
> + cgrp = ERR_PTR(-ENOENT);
> + }
> +
> + mutex_unlock(_mutex);
> + return cgrp;
> +}
> +EXPORT_SYMBOL_GPL(cgroup_get_from_path);
> +
>  #ifdef CONFIG_CGROUP_DEBUG
>  static struct cgroup_subsys_state *
>  debug_css_alloc(struct cgroup_subsys_state *parent_css)
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 4/5] misc: eeprom_93xx46: Add quirks to support Atmel AT93C46D device.

2015-12-21 Thread Vladimir Zapolskiy


With best wishes,
Vladimir

On 10.12.2015 06:00, Cory Tusar wrote:
> Atmel devices in this family have some quirks not found in other similar
> chips - they do not support a sequential read of the entire EEPROM
> contents, and the control word sent at the start of each operation
> varies in bit length.
> 
> This commit adds quirk support to the driver and modifies the read
> implementation to support non-sequential reads for consistency with
> other misc/eeprom drivers.
> 
> Tested on a custom Freescale VF610-based platform, with an AT93C46D
> device attached via dspi2.  The spi-gpio driver was used to allow the
> necessary non-byte-sized transfers.
> 
> Signed-off-by: Cory Tusar 
> Tested-by: Chris Healy 
> ---
>  drivers/misc/eeprom/eeprom_93xx46.c | 126 
> ++--
>  include/linux/eeprom_93xx46.h   |   6 ++
>  2 files changed, 97 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/misc/eeprom/eeprom_93xx46.c 
> b/drivers/misc/eeprom/eeprom_93xx46.c
> index cc27e11..d50bc17 100644
> --- a/drivers/misc/eeprom/eeprom_93xx46.c
> +++ b/drivers/misc/eeprom/eeprom_93xx46.c
> @@ -27,6 +27,15 @@
>  #define ADDR_ERAL0x20
>  #define ADDR_EWEN0x30
>  
> +struct eeprom_93xx46_devtype_data {
> + unsigned int quirks;
> +};
> +
> +static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = {
> + .quirks = EEPROM_93XX46_QUIRK_SINGLE_WORD_READ |
> +   EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH,
> +};
> +
>  struct eeprom_93xx46_dev {
>   struct spi_device *spi;
>   struct eeprom_93xx46_platform_data *pdata;
> @@ -35,6 +44,16 @@ struct eeprom_93xx46_dev {
>   int addrlen;
>  };
>  
> +static inline bool has_quirk_single_word_read(struct eeprom_93xx46_dev *edev)
> +{
> + return edev->pdata->quirks & EEPROM_93XX46_QUIRK_SINGLE_WORD_READ;
> +}
> +
> +static inline bool has_quirk_instruction_length(struct eeprom_93xx46_dev 
> *edev)
> +{
> + return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH;
> +}
> +
>  static ssize_t
>  eeprom_93xx46_bin_read(struct file *filp, struct kobject *kobj,
>  struct bin_attribute *bin_attr,
> @@ -42,58 +61,73 @@ eeprom_93xx46_bin_read(struct file *filp, struct kobject 
> *kobj,
>  {
>   struct eeprom_93xx46_dev *edev;
>   struct device *dev;
> - struct spi_message m;
> - struct spi_transfer t[2];
> - int bits, ret;
> - u16 cmd_addr;
> + ssize_t ret = 0;
>  
>   dev = container_of(kobj, struct device, kobj);
>   edev = dev_get_drvdata(dev);
>  
> - cmd_addr = OP_READ << edev->addrlen;
> + mutex_lock(>lock);
>  
> - if (edev->addrlen == 7) {
> - cmd_addr |= off & 0x7f;
> - bits = 10;
> - } else {
> - cmd_addr |= (off >> 1) & 0x3f;
> - bits = 9;
> - }
> + if (edev->pdata->prepare)
> + edev->pdata->prepare(edev);
>  
> - dev_dbg(>spi->dev, "read cmd 0x%x, %d Hz\n",
> - cmd_addr, edev->spi->max_speed_hz);
> + while (count) {
> + struct spi_message m;
> + struct spi_transfer t[2] = { { 0 } };
> + u16 cmd_addr = OP_READ << edev->addrlen;
> + size_t nbytes = count;
> + int bits;
> + int err;
> +
> + if (edev->addrlen == 7) {
> + cmd_addr |= off & 0x7f;
> + bits = 10;
> + if (has_quirk_single_word_read(edev))
> + nbytes = 1;
> + } else {
> + cmd_addr |= (off >> 1) & 0x3f;
> + bits = 9;
> + if (has_quirk_single_word_read(edev))
> + nbytes = 2;
> + }
>  
> - spi_message_init();
> - memset(t, 0, sizeof(t));
> + dev_dbg(>spi->dev, "read cmd 0x%x, %d Hz\n",
> + cmd_addr, edev->spi->max_speed_hz);
>  
> - t[0].tx_buf = (char *)_addr;
> - t[0].len = 2;
> - t[0].bits_per_word = bits;
> - spi_message_add_tail([0], );
> + spi_message_init();
>  
> - t[1].rx_buf = buf;
> - t[1].len = count;
> - t[1].bits_per_word = 8;
> - spi_message_add_tail([1], );
> + t[0].tx_buf = (char *)_addr;
> + t[0].len = 2;
> + t[0].bits_per_word = bits;
> + spi_message_add_tail([0], );
>  
> - mutex_lock(>lock);
> + t[1].rx_buf = buf;
> + t[1].len = count;
> + t[1].bits_per_word = 8;
> + spi_message_add_tail([1], );
>  
> - if (edev->pdata->prepare)
> - edev->pdata->prepare(edev);
> + err = spi_sync(edev->spi, );
> + /* have to wait at least Tcsl ns */
> + ndelay(250);
>  
> - ret = spi_sync(edev->spi, );
> - /* have to wait at least Tcsl ns */
> - ndelay(250);
> - if (ret) {
> - dev_err(>spi->dev, "read %zu bytes at %d: err. %d\n",
> - 

[POC][PATCH 08/83] affs_evict_inode(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/affs/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index dcfa753..dac9c7a 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -256,7 +256,7 @@ out:
 void
 affs_evict_inode(struct inode *inode)
 {
-   unsigned long cache_page;
+   void *cache_page;
pr_debug("evict_inode(ino=%lu, nlink=%u)\n",
 inode->i_ino, inode->i_nlink);
truncate_inode_pages_final(>i_data);
@@ -269,12 +269,12 @@ affs_evict_inode(struct inode *inode)
invalidate_inode_buffers(inode);
clear_inode(inode);
affs_free_prealloc(inode);
-   cache_page = (unsigned long)AFFS_I(inode)->i_lc;
+   cache_page = AFFS_I(inode)->i_lc;
if (cache_page) {
pr_debug("freeing ext cache\n");
AFFS_I(inode)->i_lc = NULL;
AFFS_I(inode)->i_ac = NULL;
-   free_page((void *)cache_page);
+   free_page(cache_page);
}
affs_brelse(AFFS_I(inode)->i_ext_bh);
AFFS_I(inode)->i_ext_last = ~1;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 07/83] drivers/net/wireless/mwifiex/debugfs.c: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/net/wireless/mwifiex/debugfs.c | 84 ++
 1 file changed, 35 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/debugfs.c 
b/drivers/net/wireless/mwifiex/debugfs.c
index bc23464..c9d83f9 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -79,8 +79,8 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
struct net_device *netdev = priv->netdev;
struct netdev_hw_addr *ha;
struct netdev_queue *txq;
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *p = (char *) page, fmt[64];
+   char *page = get_zeroed_page(GFP_KERNEL);
+   char *p = page, fmt[64];
struct mwifiex_bss_info info;
ssize_t ret;
int i = 0;
@@ -143,11 +143,10 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
}
p += sprintf(p, "\n");
 
-   ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page,
- (unsigned long) p - page);
+   ret = simple_read_from_buffer(ubuf, count, ppos, page, p - page);
 
 free_and_exit:
-   free_page((void *)page);
+   free_page(page);
return ret;
 }
 
@@ -201,8 +200,8 @@ mwifiex_getlog_read(struct file *file, char __user *ubuf,
 {
struct mwifiex_private *priv =
(struct mwifiex_private *) file->private_data;
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *p = (char *) page;
+   char *page = get_zeroed_page(GFP_KERNEL);
+   char *p = page;
ssize_t ret;
struct mwifiex_ds_get_stats stats;
 
@@ -253,11 +252,10 @@ mwifiex_getlog_read(struct file *file, char __user *ubuf,
 stats.bcn_miss_cnt);
 
 
-   ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page,
- (unsigned long) p - page);
+   ret = simple_read_from_buffer(ubuf, count, ppos, page, p - page);
 
 free_and_exit:
-   free_page((void *)page);
+   free_page(page);
return ret;
 }
 
@@ -280,8 +278,8 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,
ssize_t ret;
struct mwifiex_histogram_data *phist_data;
int i, value;
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *p = (char *)page;
+   char *page = get_zeroed_page(GFP_KERNEL);
+   char *p = page;
 
if (!p)
return -ENOMEM;
@@ -341,8 +339,7 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,
i, value);
}
 
-   ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
- (unsigned long)p - page);
+   ret = simple_read_from_buffer(ubuf, count, ppos, page, p - page);
 
return ret;
 }
@@ -413,8 +410,8 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
 {
struct mwifiex_private *priv =
(struct mwifiex_private *) file->private_data;
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *p = (char *) page;
+   char *page = get_zeroed_page(GFP_KERNEL);
+   char *p = page;
ssize_t ret;
 
if (!p)
@@ -426,11 +423,10 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
 
p += mwifiex_debug_info_to_buffer(priv, p, );
 
-   ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page,
- (unsigned long) p - page);
+   ret = simple_read_from_buffer(ubuf, count, ppos, page, p - page);
 
 free_and_exit:
-   free_page((void *)page);
+   free_page(page);
return ret;
 }
 
@@ -447,8 +443,7 @@ static ssize_t
 mwifiex_regrdwr_write(struct file *file,
  const char __user *ubuf, size_t count, loff_t *ppos)
 {
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *) addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
size_t buf_size = min_t(size_t, count, PAGE_SIZE - 1);
int ret;
u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
@@ -474,7 +469,7 @@ mwifiex_regrdwr_write(struct file *file,
ret = count;
}
 done:
-   free_page((void *)addr);
+   free_page(buf);
return ret;
 }
 
@@ -491,8 +486,7 @@ mwifiex_regrdwr_read(struct file *file, char __user *ubuf,
 {
struct mwifiex_private *priv =
(struct mwifiex_private *) file->private_data;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *) addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
int pos = 0, ret = 0;
u32 reg_value;
 
@@ -531,7 +525,7 @@ mwifiex_regrdwr_read(struct file *file, char __user *ubuf,
ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos);
 
 done:
-   

[POC][PATCH 06/83] drivers/net/wireless/libertas/debugfs.c: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/net/wireless/libertas/debugfs.c | 81 +
 1 file changed, 32 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/libertas/debugfs.c 
b/drivers/net/wireless/libertas/debugfs.c
index 12da2fa..a189a09 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -34,8 +34,7 @@ static ssize_t lbs_dev_info(struct file *file, char __user 
*userbuf,
 {
struct lbs_private *priv = file->private_data;
size_t pos = 0;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
ssize_t res;
if (!buf)
return -ENOMEM;
@@ -47,7 +46,7 @@ static ssize_t lbs_dev_info(struct file *file, char __user 
*userbuf,
 
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
 
-   free_page((void *)addr);
+   free_page(buf);
return res;
 }
 
@@ -59,8 +58,7 @@ static ssize_t lbs_sleepparams_write(struct file *file,
ssize_t buf_size, ret;
struct sleep_params sp;
int p1, p2, p3, p4, p5, p6;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -88,7 +86,7 @@ static ssize_t lbs_sleepparams_write(struct file *file,
ret = -EINVAL;
 
 out_unlock:
-   free_page((void *)addr);
+   free_page(buf);
return ret;
 }
 
@@ -99,8 +97,7 @@ static ssize_t lbs_sleepparams_read(struct file *file, char 
__user *userbuf,
ssize_t ret;
size_t pos = 0;
struct sleep_params sp;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -116,7 +113,7 @@ static ssize_t lbs_sleepparams_read(struct file *file, char 
__user *userbuf,
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
 
 out_unlock:
-   free_page((void *)addr);
+   free_page(buf);
return ret;
 }
 
@@ -127,8 +124,7 @@ static ssize_t lbs_host_sleep_write(struct file *file,
struct lbs_private *priv = file->private_data;
ssize_t buf_size, ret;
int host_sleep;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -162,7 +158,7 @@ static ssize_t lbs_host_sleep_write(struct file *file,
ret = count;
 
 out_unlock:
-   free_page((void *)addr);
+   free_page(buf);
return ret;
 }
 
@@ -172,8 +168,7 @@ static ssize_t lbs_host_sleep_read(struct file *file, char 
__user *userbuf,
struct lbs_private *priv = file->private_data;
ssize_t ret;
size_t pos = 0;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -181,7 +176,7 @@ static ssize_t lbs_host_sleep_read(struct file *file, char 
__user *userbuf,
 
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
 
-   free_page((void *)addr);
+   free_page(buf);
return ret;
 }
 
@@ -230,12 +225,11 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, 
uint16_t event_mask,
struct lbs_private *priv = file->private_data;
ssize_t ret = 0;
size_t pos = 0;
-   char *buf;
+   char *buf = get_zeroed_page(GFP_KERNEL);
u8 value;
u8 freq;
int events = 0;
 
-   buf = (char *)get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -284,10 +278,9 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, 
uint16_t event_mask,
ssize_t buf_size;
int value, freq, new_mask;
uint16_t curr_mask;
-   char *buf;
+   char *buf = get_zeroed_page(GFP_KERNEL);
int ret;
 
-   buf = (char *)get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
@@ -449,8 +442,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char 
__user *userbuf,
struct lbs_private *priv = file->private_data;
ssize_t pos = 0;
int ret;
-   unsigned long addr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   char *buf = (char *)addr;
+   char *buf = get_zeroed_page(GFP_KERNEL);
u32 val = 0;
 
if (!buf)
@@ -463,7 +455,7 @@ static ssize_t lbs_rdmac_read(struct file *file, char 
__user *userbuf,
priv->mac_offset, val);
ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
}
-   free_page((void *)addr);
+   

[POC][PATCH 02/83] switch free_pages() from unsigned long to const void *

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/alpha/include/asm/agp.h   |  2 +-
 arch/alpha/kernel/pci-noop.c   |  2 +-
 arch/alpha/kernel/pci_iommu.c  |  4 ++--
 arch/arc/include/asm/pgalloc.h |  6 +++---
 arch/arm/include/asm/tlb.h |  2 +-
 arch/arm/kvm/mmu.c |  4 ++--
 arch/arm/mm/pgd.c  |  2 +-
 arch/blackfin/include/asm/mmu_context.h|  2 +-
 arch/cris/arch-v32/drivers/pci/dma.c   |  2 +-
 arch/frv/mm/dma-alloc.c|  2 +-
 arch/h8300/kernel/dma.c|  2 +-
 arch/ia64/hp/common/sba_iommu.c|  2 +-
 arch/ia64/include/asm/agp.h|  2 +-
 arch/ia64/include/asm/thread_info.h|  2 +-
 arch/ia64/include/asm/tlb.h|  2 +-
 arch/ia64/kernel/uncached.c|  2 +-
 arch/ia64/sn/pci/pci_dma.c |  4 ++--
 arch/ia64/sn/pci/tioca_provider.c  |  2 +-
 arch/m68k/kernel/dma.c |  2 +-
 arch/m68k/sun3/sun3dvma.c  |  4 ++--
 arch/microblaze/kernel/dma.c   |  2 +-
 arch/microblaze/mm/consistent.c|  4 ++--
 arch/mips/include/asm/mach-generic/floppy.h|  2 +-
 arch/mips/include/asm/mach-jazz/floppy.h   |  2 +-
 arch/mips/include/asm/pgalloc.h|  6 +++---
 arch/mips/mm/dma-default.c |  2 +-
 arch/mn10300/mm/dma-alloc.c|  2 +-
 arch/nios2/include/asm/pgalloc.h   |  4 ++--
 arch/nios2/mm/dma-mapping.c|  2 +-
 arch/parisc/include/asm/agp.h  |  2 +-
 arch/parisc/include/asm/floppy.h   |  2 +-
 arch/parisc/include/asm/pgalloc.h  |  4 ++--
 arch/parisc/kernel/pci-dma.c   |  4 ++--
 arch/powerpc/include/asm/agp.h |  2 +-
 arch/powerpc/kernel/dma.c  |  2 +-
 arch/powerpc/kernel/iommu.c|  6 +++---
 arch/powerpc/kvm/book3s_64_mmu_hv.c|  4 ++--
 arch/powerpc/kvm/booke.c   |  2 +-
 arch/powerpc/mm/init_64.c  |  3 +--
 arch/powerpc/mm/pgtable_32.c   |  2 +-
 arch/powerpc/platforms/cell/spufs/inode.c  |  2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c  |  2 +-
 arch/powerpc/platforms/ps3/system-bus.c|  4 ++--
 arch/s390/hypfs/hypfs_diag.c   |  2 +-
 arch/s390/include/asm/idals.h  |  5 ++---
 arch/s390/kernel/smp.c |  8 
 arch/s390/kernel/suspend.c |  2 +-
 arch/s390/kernel/vdso.c|  4 ++--
 arch/s390/mm/pgtable.c |  4 ++--
 arch/s390/pci/pci_clp.c|  2 +-
 arch/s390/pci/pci_dma.c|  4 ++--
 arch/score/include/asm/pgalloc.h   |  4 ++--
 arch/sh/mm/consistent.c|  2 +-
 arch/sparc/include/asm/agp.h   |  2 +-
 arch/sparc/kernel/iommu.c  |  4 ++--
 arch/sparc/kernel/ioport.c |  6 +++---
 arch/sparc/kernel/ldc.c|  6 +++---
 arch/sparc/kernel/pci_fire.c   |  2 +-
 arch/sparc/kernel/pci_sun4v.c  |  8 
 arch/um/drivers/net_kern.c |  2 +-
 arch/um/kernel/process.c   |  2 +-
 arch/unicore32/mm/pgd.c|  4 ++--
 arch/x86/include/asm/agp.h |  2 +-
 arch/x86/include/asm/floppy.h  |  2 +-
 arch/x86/include/asm/xen/page-coherent.h   |  2 +-
 arch/x86/kernel/pci-calgary_64.c   |  6 +++---
 arch/x86/kernel/pci-dma.c  |  2 +-
 arch/x86/kvm/vmx.c |  2 +-
 arch/x86/mm/init_64.c  |  2 +-
 arch/x86/platform/efi/efi.c|  4 ++--
 arch/x86/um/ldt.c  |  2 +-
 arch/x86/xen/pmu.c |  4 ++--
 arch/xtensa/kernel/pci-dma.c   |  2 +-
 crypto/xor.c   |  2 +-
 drivers/base/devres.c  |  4 ++--
 drivers/block/floppy.c |  2 +-
 drivers/block/ps3vram.c|  4 ++--
 drivers/block/xen-blkfront.c   |  4 ++--
 drivers/block/zram/zcomp.c |  2 +-
 drivers/char/agp/hp-agp.c  |  2 +-
 drivers/char/agp/uninorth-agp.c|  4 ++--
 

Re: [PATCH v4 3/5] misc: eeprom_93xx46: Implement eeprom_93xx46 DT bindings.

2015-12-21 Thread Vladimir Zapolskiy
Hi Cory,

On 10.12.2015 06:00, Cory Tusar wrote:
> This commit implements bindings in the eeprom_93xx46 driver allowing
> device word size and read-only attributes to be specified via
> devicetree.
> 
> Signed-off-by: Cory Tusar 
> Tested-by: Chris Healy 
> ---
>  drivers/misc/eeprom/eeprom_93xx46.c | 49 
> +
>  1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/misc/eeprom/eeprom_93xx46.c 
> b/drivers/misc/eeprom/eeprom_93xx46.c
> index e1bf0a5..cc27e11 100644
> --- a/drivers/misc/eeprom/eeprom_93xx46.c
> +++ b/drivers/misc/eeprom/eeprom_93xx46.c
> @@ -13,6 +13,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -294,12 +296,58 @@ static ssize_t eeprom_93xx46_store_erase(struct device 
> *dev,
>  }
>  static DEVICE_ATTR(erase, S_IWUSR, NULL, eeprom_93xx46_store_erase);
>  
> +static const struct of_device_id eeprom_93xx46_of_table[] = {
> + { .compatible = "eeprom-93xx46", },

immediately do you want to add the second (and much, much more preferred IMO)
mentioned compatible value "atmel,at93c46d" to the list? Also see a note
below.

> + {}
> +};
> +MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table);
> +
> +static int eeprom_93xx46_probe_dt(struct spi_device *spi)
> +{
> + struct device_node *np = spi->dev.of_node;
> + struct eeprom_93xx46_platform_data *pd;
> + u32 tmp;
> + int ret;
> +
> + pd = devm_kzalloc(>dev, sizeof(*pd), GFP_KERNEL);
> + if (!pd)
> + return -ENOMEM;
> +
> + ret = of_property_read_u32(np, "data-size", );
> + if (ret < 0) {
> + dev_err(>dev, "data-size property not found\n");
> + return ret;
> + }
> +
> + if (tmp == 8) {
> + pd->flags |= EE_ADDR8;
> + } else if (tmp == 16) {
> + pd->flags |= EE_ADDR16;
> + } else {
> + dev_err(>dev, "invalid data-size (%d)\n", tmp);
> + return -EINVAL;
> + }

If you insist on mandatory "data-size" property, could you please check
arch/x86/platform/ce4100/falconfalls.dts , does it require updates?

In that DTS you may find "atmel,at93c46" compatible value, is that kind
of devices covered by this driver? If yes, does it make sense to
add "atmel,at93c46" to the list of compatible values replacing
"atmel,at93c46d" ?

> +
> + if (of_property_read_bool(np, "read-only"))
> + pd->flags |= EE_READONLY;
> +
> + spi->dev.platform_data = pd;
> +
> + return 0;
> +}
> +
>  static int eeprom_93xx46_probe(struct spi_device *spi)
>  {
>   struct eeprom_93xx46_platform_data *pd;
>   struct eeprom_93xx46_dev *edev;
>   int err;
>  
> + if (spi->dev.of_node) {
> + err = eeprom_93xx46_probe_dt(spi);
> + if (err < 0)
> + return err;
> + }
> +
>   pd = spi->dev.platform_data;
>   if (!pd) {
>   dev_err(>dev, "missing platform data\n");
> @@ -370,6 +418,7 @@ static int eeprom_93xx46_remove(struct spi_device *spi)
>  static struct spi_driver eeprom_93xx46_driver = {
>   .driver = {
>   .name   = "93xx46",
> + .of_match_table = of_match_ptr(eeprom_93xx46_of_table),
>   },
>   .probe  = eeprom_93xx46_probe,
>   .remove = eeprom_93xx46_remove,
> 

Reviewed-by: Vladimir Zapolskiy 

--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 03/83] switch get_zeroed_page() to returning void *

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/arm64/kernel/vdso.c|  2 +-
 arch/ia64/hp/sim/simserial.c|  2 +-
 arch/nios2/mm/init.c|  2 +-
 arch/s390/kernel/perf_cpum_sf.c |  2 +-
 arch/s390/kernel/vdso.c |  4 ++--
 arch/s390/kvm/kvm-s390.c|  2 +-
 arch/s390/kvm/priv.c|  4 ++--
 arch/s390/oprofile/hwsampler.c  |  2 +-
 arch/sh/boards/mach-hp6xx/pm.c  |  2 +-
 arch/sparc/kernel/irq_64.c  |  2 +-
 arch/sparc/kernel/pci_sun4v.c   |  2 +-
 arch/um/kernel/skas/mmu.c   |  2 +-
 arch/x86/kernel/amd_gart_64.c   |  2 +-
 drivers/char/agp/efficeon-agp.c |  2 +-
 drivers/hsi/clients/cmt_speech.c|  2 +-
 drivers/infiniband/hw/qib/qib_qp.c  |  2 +-
 drivers/lguest/lguest_user.c|  2 +-
 drivers/lguest/page_tables.c|  4 ++--
 drivers/net/wireless/libertas/debugfs.c | 30 +++---
 drivers/net/wireless/mwifiex/debugfs.c  | 28 ++--
 drivers/s390/char/sclp_ftp.c|  2 +-
 drivers/s390/cio/qdio_main.c|  2 +-
 drivers/s390/net/qeth_core_main.c   |  2 +-
 drivers/staging/rdma/ehca/ipz_pt_fn.c   |  2 +-
 drivers/staging/rdma/hfi1/qp.c  |  2 +-
 drivers/staging/rdma/ipath/ipath_qp.c   |  2 +-
 drivers/tty/amiserial.c |  2 +-
 drivers/tty/cyclades.c  |  2 +-
 drivers/tty/serial/crisv10.c|  2 +-
 drivers/tty/serial/serial_core.c|  2 +-
 drivers/usb/mon/mon_bin.c   |  2 +-
 drivers/xen/xenbus/xenbus_probe.c   |  2 +-
 fs/configfs/symlink.c   |  2 +-
 fs/kernfs/symlink.c |  2 +-
 include/linux/gfp.h |  2 +-
 mm/page_alloc.c |  4 ++--
 net/atm/proc.c  |  2 +-
 net/rds/cong.c  |  2 +-
 sound/oss/vidc.c|  2 +-
 39 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 97bc68f..07e4d14 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -64,7 +64,7 @@ static int alloc_vectors_page(void)
int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
unsigned long vpage;
 
-   vpage = get_zeroed_page(GFP_ATOMIC);
+   vpage = (unsigned long)get_zeroed_page(GFP_ATOMIC);
 
if (!vpage)
return -ENOMEM;
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 36b3217..6e81449 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -367,7 +367,7 @@ static int activate(struct tty_port *port, struct 
tty_struct *tty)
unsigned long flags, page;
int retval = 0;
 
-   page = get_zeroed_page(GFP_KERNEL);
+   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c
index e75c75d..e03a757 100644
--- a/arch/nios2/mm/init.c
+++ b/arch/nios2/mm/init.c
@@ -105,7 +105,7 @@ static int alloc_kuser_page(void)
int kuser_sz = __kuser_helper_end - __kuser_helper_start;
unsigned long vpage;
 
-   vpage = get_zeroed_page(GFP_ATOMIC);
+   vpage = (unsigned long)get_zeroed_page(GFP_ATOMIC);
if (!vpage)
return -ENOMEM;
 
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 0dca133..9698d67 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -158,7 +158,7 @@ static int alloc_sample_data_block(unsigned long *sdbt, 
gfp_t gfp_flags)
unsigned long sdb, *trailer;
 
/* Allocate and initialize sample-data-block */
-   sdb = get_zeroed_page(gfp_flags);
+   sdb = (unsigned long)get_zeroed_page(gfp_flags);
if (!sdb)
return -ENOMEM;
trailer = trailer_entry_ptr(sdb);
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 2518d55..d0ec7748 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -102,8 +102,8 @@ int vdso_alloc_per_cpu(struct _lowcore *lowcore)
return 0;
 
segment_table = __get_free_pages(GFP_KERNEL, SEGMENT_ORDER);
-   page_table = get_zeroed_page(GFP_KERNEL | GFP_DMA);
-   page_frame = get_zeroed_page(GFP_KERNEL);
+   page_table = (unsigned long)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+   page_frame = (unsigned long)get_zeroed_page(GFP_KERNEL);
if (!segment_table || !page_table || !page_frame)
goto out;
 
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 940dd42..2b7580c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1396,7 +1396,7 @@ void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu)
 
 int kvm_s390_vcpu_setup_cmma(struct kvm_vcpu *vcpu)
 {
-   

[POC][PATCH 13/83] rds: keep pointers in ->m_page_addrs[]

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 net/rds/cong.c | 16 
 net/rds/ib_recv.c  |  2 +-
 net/rds/iw_recv.c  |  2 +-
 net/rds/message.c  |  2 +-
 net/rds/rds.h  |  4 ++--
 net/rds/tcp_recv.c |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/net/rds/cong.c b/net/rds/cong.c
index 6f91538..a56b076 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -136,7 +136,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
 {
struct rds_cong_map *map;
struct rds_cong_map *ret = NULL;
-   unsigned long zp;
+   void *zp;
unsigned long i;
unsigned long flags;
 
@@ -149,8 +149,8 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
INIT_LIST_HEAD(>m_conn_list);
 
for (i = 0; i < RDS_CONG_MAP_PAGES; i++) {
-   zp = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   if (zp == 0)
+   zp = get_zeroed_page(GFP_KERNEL);
+   if (!zp)
goto out;
map->m_page_addrs[i] = zp;
}
@@ -167,7 +167,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
 out:
if (map) {
for (i = 0; i < RDS_CONG_MAP_PAGES && map->m_page_addrs[i]; i++)
-   free_page((void *)map->m_page_addrs[i]);
+   free_page(map->m_page_addrs[i]);
kfree(map);
}
 
@@ -299,7 +299,7 @@ void rds_cong_set_bit(struct rds_cong_map *map, __be16 port)
i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-   __set_bit_le(off, (void *)map->m_page_addrs[i]);
+   __set_bit_le(off, map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -313,7 +313,7 @@ void rds_cong_clear_bit(struct rds_cong_map *map, __be16 
port)
i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-   __clear_bit_le(off, (void *)map->m_page_addrs[i]);
+   __clear_bit_le(off, map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
@@ -324,7 +324,7 @@ static int rds_cong_test_bit(struct rds_cong_map *map, 
__be16 port)
i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-   return test_bit_le(off, (void *)map->m_page_addrs[i]);
+   return test_bit_le(off, map->m_page_addrs[i]);
 }
 
 void rds_cong_add_socket(struct rds_sock *rs)
@@ -399,7 +399,7 @@ void rds_cong_exit(void)
rdsdebug("freeing map %p\n", map);
rb_erase(>m_rb_node, _cong_tree);
for (i = 0; i < RDS_CONG_MAP_PAGES && map->m_page_addrs[i]; i++)
-   free_page((void *)map->m_page_addrs[i]);
+   free_page(map->m_page_addrs[i]);
kfree(map);
}
 }
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 977fb86..74cb081 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -797,7 +797,7 @@ static void rds_ib_cong_recv(struct rds_connection *conn,
addr = kmap_atomic(sg_page(>f_sg));
 
src = addr + frag_off;
-   dst = (void *)map->m_page_addrs[map_page] + map_off;
+   dst = map->m_page_addrs[map_page] + map_off;
for (k = 0; k < to_copy; k += 8) {
/* Record ports that became uncongested, ie
 * bits that changed from 0 to 1. */
diff --git a/net/rds/iw_recv.c b/net/rds/iw_recv.c
index a66d179..c83e6e2 100644
--- a/net/rds/iw_recv.c
+++ b/net/rds/iw_recv.c
@@ -586,7 +586,7 @@ static void rds_iw_cong_recv(struct rds_connection *conn,
addr = kmap_atomic(frag->f_page);
 
src = addr + frag_off;
-   dst = (void *)map->m_page_addrs[map_page] + map_off;
+   dst = map->m_page_addrs[map_page] + map_off;
for (k = 0; k < to_copy; k += 8) {
/* Record ports that became uncongested, ie
 * bits that changed from 0 to 1. */
diff --git a/net/rds/message.c b/net/rds/message.c
index 756c737..6adea64 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -235,7 +235,7 @@ struct scatterlist *rds_message_alloc_sgs(struct 
rds_message *rm, int nents)
return sg_ret;
 }
 
-struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned 
int total_len)
+struct rds_message *rds_message_map_pages(void **page_addrs, unsigned int 
total_len)
 {
struct rds_message *rm;
unsigned int i;
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 0e2797b..d315431 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -59,7 +59,7 @@ struct rds_cong_map {
__be32  m_addr;
wait_queue_head_t   m_waitq;
struct list_headm_conn_list;
-   unsigned long   

[POC][PATCH 14/83] proc_dev_atm_read(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 net/atm/proc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/atm/proc.c b/net/atm/proc.c
index cf8993a..d04e11f 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -377,28 +377,28 @@ static ssize_t proc_dev_atm_read(struct file *file, char 
__user *buf,
 size_t count, loff_t *pos)
 {
struct atm_dev *dev;
-   unsigned long page;
+   char *page;
int length;
 
if (count == 0)
return 0;
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
dev = PDE_DATA(file_inode(file));
if (!dev->ops->proc_read)
length = -EINVAL;
else {
-   length = dev->ops->proc_read(dev, pos, (char *)page);
+   length = dev->ops->proc_read(dev, pos, page);
if (length > count)
length = -EINVAL;
}
if (length >= 0) {
-   if (copy_to_user(buf, (char *)page, length))
+   if (copy_to_user(buf, page, length))
length = -EFAULT;
(*pos)++;
}
-   free_page((void *)page);
+   free_page(page);
return length;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 09/83] configfs_follow_link(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/configfs/symlink.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index f8f4d9a..ae41e92 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -281,18 +281,18 @@ static int configfs_getlink(struct dentry *dentry, char * 
path)
 
 static const char *configfs_follow_link(struct dentry *dentry, void **cookie)
 {
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   void *page = get_zeroed_page(GFP_KERNEL);
int error;
 
if (!page)
return ERR_PTR(-ENOMEM);
 
-   error = configfs_getlink(dentry, (char *)page);
+   error = configfs_getlink(dentry, page);
if (!error) {
-   return *cookie = (void *)page;
+   return *cookie = page;
}
 
-   free_page((void *)page);
+   free_page(page);
return ERR_PTR(error);
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 11/83] sound/oss/vidc: keep dma_buf[] as pointers

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 sound/oss/vidc.c | 8 
 sound/oss/vidc.h | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c
index 3196f35..6ab875d 100644
--- a/sound/oss/vidc.c
+++ b/sound/oss/vidc.c
@@ -468,13 +468,13 @@ static void __init attach_vidc(struct address_info 
*hw_config)
goto mixer_failed;
 
for (i = 0; i < 2; i++) {
-   dma_buf[i] = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   dma_buf[i] = get_zeroed_page(GFP_KERNEL);
if (!dma_buf[i]) {
printk(KERN_ERR "%s: can't allocate required buffers\n",
name);
goto mem_failed;
}
-   dma_pbuf[i] = virt_to_phys((void *)dma_buf[i]);
+   dma_pbuf[i] = virt_to_phys(dma_buf[i]);
}
 
if (sound_alloc_dma(hw_config->dma, hw_config->name)) {
@@ -497,7 +497,7 @@ irq_failed:
 dma_failed:
 mem_failed:
for (i = 0; i < 2; i++)
-   free_page((void *)dma_buf[i]);
+   free_page(dma_buf[i]);
sound_unload_mixerdev(audio_devs[adev]->mixer_dev);
 mixer_failed:
sound_unload_audiodev(adev);
@@ -528,7 +528,7 @@ static void __exit unload_vidc(struct address_info 
*hw_config)
sound_unload_mixerdev(audio_devs[adev]->mixer_dev);
sound_unload_audiodev(adev);
for (i = 0; i < 2; i++)
-   free_page((void *)dma_buf[i]);
+   free_page(dma_buf[i]);
}
 }
 
diff --git a/sound/oss/vidc.h b/sound/oss/vidc.h
index 0d14247..f079010 100644
--- a/sound/oss/vidc.h
+++ b/sound/oss/vidc.h
@@ -53,7 +53,8 @@ extern irqreturn_t (*dma_interrupt) (void);
  */
 
 extern unsigned long dma_start, dma_count, dma_bufsize;
-extern unsigned long dma_buf[2], dma_pbuf[2];
+extern unsigned long dma_pbuf[2];
+extern void *dma_buf[2];
 
 /* vidc_synth.c */
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 12/83] drivers/tty: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/tty/amiserial.c  | 10 +-
 drivers/tty/cyclades.c   | 10 +-
 drivers/tty/mxser.c  |  8 
 drivers/tty/rocket.c |  8 
 drivers/tty/serial/crisv10.c | 10 +-
 drivers/tty/serial/serial_core.c |  6 +++---
 drivers/tty/tty_port.c   |  2 +-
 7 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index ec87a8c..43605c9 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -518,23 +518,23 @@ static int startup(struct tty_struct *tty, struct 
serial_state *info)
struct tty_port *port = >tport;
unsigned long flags;
int retval=0;
-   unsigned long page;
+   unsigned char *page;
 
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
local_irq_save(flags);
 
if (port->flags & ASYNC_INITIALIZED) {
-   free_page((void *)page);
+   free_page(page);
goto errout;
}
 
if (info->xmit.buf)
-   free_page((void *)page);
+   free_page(page);
else
-   info->xmit.buf = (unsigned char *) page;
+   info->xmit.buf = page;
 
 #ifdef SERIAL_DEBUG_OPEN
printk("starting up ttys%d ...", info->line);
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 7e3bee8..fa4edc1 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1268,12 +1268,12 @@ static int cy_startup(struct cyclades_port *info, 
struct tty_struct *tty)
unsigned long flags;
int retval = 0;
int channel;
-   unsigned long page;
+   unsigned char *page;
 
card = info->card;
channel = info->line - card->first_line;
 
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
@@ -1288,9 +1288,9 @@ static int cy_startup(struct cyclades_port *info, struct 
tty_struct *tty)
}
 
if (info->port.xmit_buf)
-   free_page((void *)page);
+   free_page(page);
else
-   info->port.xmit_buf = (unsigned char *)page;
+   info->port.xmit_buf = page;
 
spin_unlock_irqrestore(>card_lock, flags);
 
@@ -1383,7 +1383,7 @@ static int cy_startup(struct cyclades_port *info, struct 
tty_struct *tty)
 
 errout:
spin_unlock_irqrestore(>card_lock, flags);
-   free_page((void *)page);
+   free_page(page);
return retval;
 }  /* startup */
 
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index b730857..ee78fc2 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -862,10 +862,10 @@ static void mxser_check_modem_status(struct tty_struct 
*tty,
 static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
 {
struct mxser_port *info = container_of(port, struct mxser_port, port);
-   unsigned long page;
+   unsigned char *page;
unsigned long flags;
 
-   page = __get_free_page(GFP_KERNEL);
+   page = (unsigned char *)__get_free_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
@@ -873,11 +873,11 @@ static int mxser_activate(struct tty_port *port, struct 
tty_struct *tty)
 
if (!info->ioaddr || !info->type) {
set_bit(TTY_IO_ERROR, >flags);
-   free_page((void *)page);
+   free_page(page);
spin_unlock_irqrestore(>slock, flags);
return 0;
}
-   info->port.xmit_buf = (unsigned char *) page;
+   info->port.xmit_buf = page;
 
/*
 * Clear the FIFO buffers and disable them
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 2ed96e3..78f0330 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -884,14 +884,14 @@ static int rp_open(struct tty_struct *tty, struct file 
*filp)
struct tty_port *port;
int retval;
CHANNEL_t *cp;
-   unsigned long page;
+   unsigned char *page;
 
info = rp_table[tty->index];
if (info == NULL)
return -ENXIO;
port = >port;

-   page = __get_free_page(GFP_KERNEL);
+   page = (unsigned char *)__get_free_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
@@ -899,9 +899,9 @@ static int rp_open(struct tty_struct *tty, struct file 
*filp)
 * We must not sleep from here until the port is marked fully in use.
 */
if (info->xmit_buf)
-   free_page((void *)page);
+   free_page(page);
else
-   info->xmit_buf = (unsigned char *) page;
+   info->xmit_buf = page;
 
tty->driver_data = info;
tty_port_tty_set(port, tty);

[POC][PATCH 10/83] kernfs_iop_follow_link(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/kernfs/symlink.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c
index 9662b66..ac8768b 100644
--- a/fs/kernfs/symlink.c
+++ b/fs/kernfs/symlink.c
@@ -115,15 +115,15 @@ static int kernfs_getlink(struct dentry *dentry, char 
*path)
 static const char *kernfs_iop_follow_link(struct dentry *dentry, void **cookie)
 {
int error = -ENOMEM;
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   void *page = get_zeroed_page(GFP_KERNEL);
if (!page)
return ERR_PTR(-ENOMEM);
-   error = kernfs_getlink(dentry, (char *)page);
+   error = kernfs_getlink(dentry, page);
if (unlikely(error < 0)) {
-   free_page((void *)page);
+   free_page(page);
return ERR_PTR(error);
}
-   return *cookie = (char *)page;
+   return *cookie = page;
 }
 
 const struct inode_operations kernfs_symlink_iops = {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 17/83] ftrace: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 kernel/trace/ftrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b995e08..927cdd4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -741,10 +741,10 @@ int ftrace_profile_pages_init(struct ftrace_profile_stat 
*stat)
  out_free:
pg = stat->start;
while (pg) {
-   unsigned long tmp = (unsigned long)pg;
+   void *tmp = pg;
 
pg = pg->next;
-   free_page((void *)tmp);
+   free_page(tmp);
}
 
stat->pages = NULL;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 19/83] xenstored_local_init(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/xen/xenbus/xenbus_probe.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c 
b/drivers/xen/xenbus/xenbus_probe.c
index 3e43b5a..d896283 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -702,12 +702,12 @@ device_initcall(xenbus_probe_initcall);
  */
 static int __init xenstored_local_init(void)
 {
-   int err = 0;
-   unsigned long page = 0;
struct evtchn_alloc_unbound alloc_unbound;
+   void *page;
+   int err = 0;
 
/* Allocate Xenstore page */
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page)
goto out_err;
 
@@ -729,8 +729,7 @@ static int __init xenstored_local_init(void)
return 0;
 
  out_err:
-   if (page != 0)
-   free_page((void *)page);
+   free_page(page);
return err;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 16/83] user_namespace: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 kernel/user_namespace.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index b01948c..badce97 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -602,8 +602,7 @@ static ssize_t map_write(struct file *file, const char 
__user *buf,
struct uid_gid_map new_map;
unsigned idx;
struct uid_gid_extent *extent = NULL;
-   unsigned long page = 0;
-   char *kbuf, *pos, *next_line;
+   char *kbuf = NULL, *pos, *next_line;
ssize_t ret = -EINVAL;
 
/*
@@ -640,9 +639,8 @@ static ssize_t map_write(struct file *file, const char 
__user *buf,
 
/* Get a buffer */
ret = -ENOMEM;
-   page = __get_free_page(GFP_TEMPORARY);
-   kbuf = (char *) page;
-   if (!page)
+   kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+   if (!kbuf)
goto out;
 
/* Only allow < page size writes at the beginning of the file */
@@ -756,8 +754,7 @@ static ssize_t map_write(struct file *file, const char 
__user *buf,
ret = count;
 out:
mutex_unlock(_state_mutex);
-   if (page)
-   free_page((void *)page);
+   free_page(kbuf);
return ret;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] ata: sata_dwc_460ex: use "dmas" DT property to find dma channel

2015-12-21 Thread Måns Rullgård
Andy Shevchenko  writes:

> On Mon, 2015-12-21 at 19:27 +, Måns Rullgård wrote:
>> Andy Shevchenko  writes:
>> 
>> > I can share my working branch with a set of patches regarding to
>> > dw_dmac. We may do our work based on that code and after I'll
>> > submit
>> > everything to upstream. Does it sound okay for you, guys?
>> 
>> I'm going away for the holidays, so I won't be able to do any serious
>> work on this until January, but I'll keep an eye on emails and may
>> even reply occasionally.  Before I go, I'll publish my patches so far
>> whatever shape they're in.
>
> Okay, thanks! I will include them in my branch which I'm going to
> publish on GitHUB.

Here's what I have: https://bitbucket.org/mansr/linux-dwc
Bitbucket because Github won't let me have more than one Linux
repo.

-- 
Måns Rullgård
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 18/83] sysctl: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 kernel/sysctl.c | 31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8e9cfe4..edb7da4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2047,9 +2047,8 @@ static int __do_proc_dointvec(void *tbl_data, struct 
ctl_table *table,
  void *data)
 {
int *i, vleft, first = 1, err = 0;
-   unsigned long page = 0;
size_t left;
-   char *kbuf;
+   char *kbuf = NULL;

if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
*lenp = 0;
@@ -2078,8 +2077,7 @@ static int __do_proc_dointvec(void *tbl_data, struct 
ctl_table *table,
 
if (left > PAGE_SIZE - 1)
left = PAGE_SIZE - 1;
-   page = __get_free_page(GFP_TEMPORARY);
-   kbuf = (char *) page;
+   kbuf = (char *)__get_free_page(GFP_TEMPORARY);
if (!kbuf)
return -ENOMEM;
if (copy_from_user(kbuf, buffer, left)) {
@@ -2128,7 +2126,7 @@ static int __do_proc_dointvec(void *tbl_data, struct 
ctl_table *table,
left -= proc_skip_spaces();
 free:
if (write) {
-   free_page((void *)page);
+   free_page(kbuf);
if (first)
return err ? : -EINVAL;
}
@@ -2310,9 +2308,8 @@ static int __do_proc_doulongvec_minmax(void *data, struct 
ctl_table *table, int
 {
unsigned long *i, *min, *max;
int vleft, first = 1, err = 0;
-   unsigned long page = 0;
size_t left;
-   char *kbuf;
+   char *kbuf = NULL;
 
if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
*lenp = 0;
@@ -2340,8 +2337,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct 
ctl_table *table, int
 
if (left > PAGE_SIZE - 1)
left = PAGE_SIZE - 1;
-   page = __get_free_page(GFP_TEMPORARY);
-   kbuf = (char *) page;
+   kbuf = (char *)__get_free_page(GFP_TEMPORARY);
if (!kbuf)
return -ENOMEM;
if (copy_from_user(kbuf, buffer, left)) {
@@ -2388,7 +2384,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct 
ctl_table *table, int
left -= proc_skip_spaces();
 free:
if (write) {
-   free_page((void *)page);
+   free_page(kbuf);
if (first)
return err ? : -EINVAL;
}
@@ -2650,18 +2646,15 @@ int proc_do_large_bitmap(struct ctl_table *table, int 
write,
}
 
if (write) {
-   unsigned long page = 0;
-   char *kbuf;
+   char *kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+   if (!kbuf)
+   return -ENOMEM;
 
if (left > PAGE_SIZE - 1)
left = PAGE_SIZE - 1;
 
-   page = __get_free_page(GFP_TEMPORARY);
-   kbuf = (char *) page;
-   if (!kbuf)
-   return -ENOMEM;
if (copy_from_user(kbuf, buffer, left)) {
-   free_page((void *)page);
+   free_page(kbuf);
return -EFAULT;
 }
kbuf[left] = 0;
@@ -2669,7 +2662,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int 
write,
tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * 
sizeof(unsigned long),
 GFP_KERNEL);
if (!tmp_bitmap) {
-   free_page((void *)page);
+   free_page(kbuf);
return -ENOMEM;
}
proc_skip_char(, , '\n');
@@ -2713,7 +2706,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int 
write,
first = 0;
proc_skip_char(, , '\n');
}
-   free_page((void *)page);
+   free_page(kbuf);
} else {
unsigned long bit_a, bit_b = 0;
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 25/83] dma_4u_alloc_coherent(): don't mix virtual and physical addresses

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/sparc/kernel/iommu.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index eae7b6b..18a40c6 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -215,23 +215,22 @@ static void *dma_4u_alloc_coherent(struct device *dev, 
size_t size,
if (unlikely(!page))
return NULL;
 
-   first_page = (unsigned long) page_address(page);
-   memset((char *)first_page, 0, PAGE_SIZE << order);
+   ret =  page_address(page);
+   memset(ret, 0, PAGE_SIZE << order);
 
iommu = dev->archdata.iommu;
 
iopte = alloc_npages(dev, iommu, size >> IO_PAGE_SHIFT);
 
if (unlikely(iopte == NULL)) {
-   free_pages((void *)first_page, order);
+   free_pages(ret, order);
return NULL;
}
 
*dma_addrp = (iommu->tbl.table_map_base +
  ((iopte - iommu->page_table) << IO_PAGE_SHIFT));
-   ret = (void *) first_page;
npages = size >> IO_PAGE_SHIFT;
-   first_page = __pa(first_page);
+   first_page = __pa(ret);
while (npages--) {
iopte_val(*iopte) = (IOPTE_CONSISTENT(0UL) |
 IOPTE_WRITE |
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 24/83] ppc: keep ->hpt_virt as a pointer

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/powerpc/include/asm/kvm_host.h |  2 +-
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 19 ++-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h 
b/arch/powerpc/include/asm/kvm_host.h
index cfa758c..224d71e 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -223,7 +223,7 @@ struct kvm_arch_memory_slot {
 struct kvm_arch {
unsigned int lpid;
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
-   unsigned long hpt_virt;
+   void *hpt_virt;
struct revmap_entry *revmap;
unsigned int host_lpid;
unsigned long host_lpcr;
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index e398fdc..3dd6f8e 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -50,7 +50,7 @@ static void kvmppc_rmap_reset(struct kvm *kvm);
 
 long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
 {
-   unsigned long hpt = 0;
+   void *hpt = NULL;
struct revmap_entry *rev;
struct page *page = NULL;
long order = KVM_DEFAULT_HPT_ORDER;
@@ -64,16 +64,17 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
kvm->arch.hpt_cma_alloc = 0;
page = kvm_alloc_hpt(1ul << (order - PAGE_SHIFT));
if (page) {
-   hpt = (unsigned long)pfn_to_kaddr(page_to_pfn(page));
-   memset((void *)hpt, 0, (1ul << order));
+   hpt = pfn_to_kaddr(page_to_pfn(page));
+   memset(hpt, 0, (1ul << order));
kvm->arch.hpt_cma_alloc = 1;
}
 
/* Lastly try successively smaller sizes from the page allocator */
/* Only do this if userspace didn't specify a size via ioctl */
while (!hpt && order > PPC_MIN_HPT_ORDER && !htab_orderp) {
-   hpt = __get_free_pages(GFP_KERNEL|__GFP_ZERO|__GFP_REPEAT|
-  __GFP_NOWARN, order - PAGE_SHIFT);
+   hpt = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO|
+   __GFP_REPEAT| __GFP_NOWARN,
+   order - PAGE_SHIFT);
if (!hpt)
--order;
}
@@ -97,7 +98,7 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
kvm->arch.revmap = rev;
kvm->arch.sdr1 = __pa(hpt) | (order - 18);
 
-   pr_info("KVM guest htab at %lx (order %ld), LPID %x\n",
+   pr_info("KVM guest htab at %p (order %ld), LPID %x\n",
hpt, order, kvm->arch.lpid);
 
if (htab_orderp)
@@ -108,7 +109,7 @@ long kvmppc_alloc_hpt(struct kvm *kvm, u32 *htab_orderp)
if (kvm->arch.hpt_cma_alloc)
kvm_release_hpt(page, 1 << (order - PAGE_SHIFT));
else
-   free_pages((void *)hpt, order - PAGE_SHIFT);
+   free_pages(hpt, order - PAGE_SHIFT);
return -ENOMEM;
 }
 
@@ -130,7 +131,7 @@ long kvmppc_alloc_reset_hpt(struct kvm *kvm, u32 
*htab_orderp)
if (kvm->arch.hpt_virt) {
order = kvm->arch.hpt_order;
/* Set the entire HPT to 0, i.e. invalid HPTEs */
-   memset((void *)kvm->arch.hpt_virt, 0, 1ul << order);
+   memset(kvm->arch.hpt_virt, 0, 1ul << order);
/*
 * Reset all the reverse-mapping chains for all memslots
 */
@@ -156,7 +157,7 @@ void kvmppc_free_hpt(struct kvm *kvm)
kvm_release_hpt(virt_to_page(kvm->arch.hpt_virt),
1 << (kvm->arch.hpt_order - PAGE_SHIFT));
else
-   free_pages((void *)kvm->arch.hpt_virt,
+   free_pages(kvm->arch.hpt_virt,
   kvm->arch.hpt_order - PAGE_SHIFT);
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 23/83] fd_dma_mem_free(): pass address as void * instead of unsigned long

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/m68k/include/asm/floppy.h  |  4 ++--
 arch/mips/include/asm/mach-generic/floppy.h |  4 ++--
 arch/mips/include/asm/mach-jazz/floppy.h|  6 +++---
 arch/parisc/include/asm/floppy.h|  6 +++---
 arch/sparc/include/asm/floppy_32.h  |  2 +-
 arch/x86/include/asm/floppy.h   |  6 +++---
 drivers/block/floppy.c  | 10 +-
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h
index 47365b1..b5fb689 100644
--- a/arch/m68k/include/asm/floppy.h
+++ b/arch/m68k/include/asm/floppy.h
@@ -147,9 +147,9 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 }
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
-vfree((void *)addr);
+vfree(addr);
 }
 #define fd_dma_mem_free(addr,size) _fd_dma_mem_free(addr, size)
 
diff --git a/arch/mips/include/asm/mach-generic/floppy.h 
b/arch/mips/include/asm/mach-generic/floppy.h
index 7b0b508..1419f0d 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -122,9 +122,9 @@ static inline unsigned long fd_dma_mem_alloc(unsigned long 
size)
return mem;
 }
 
-static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
+static inline void fd_dma_mem_free(void *addr, unsigned long size)
 {
-   free_pages((void *)addr, get_order(size));
+   free_pages(addr, get_order(size));
 }
 
 static inline unsigned long fd_drive_type(unsigned long n)
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h 
b/arch/mips/include/asm/mach-jazz/floppy.h
index 4aaf35b..701dbfc 100644
--- a/arch/mips/include/asm/mach-jazz/floppy.h
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -114,10 +114,10 @@ static inline unsigned long fd_dma_mem_alloc(unsigned 
long size)
return mem;
 }
 
-static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
+static inline void fd_dma_mem_free(void *addr, unsigned long size)
 {
-   vdma_free(vdma_phys2log(CPHYSADDR(addr)));
-   free_pages((void *)addr, get_order(size));
+   vdma_free(vdma_phys2log(CPHYSADDR((unsigned long)addr)));
+   free_pages(addr, get_order(size));
 }
 
 static inline unsigned long fd_drive_type(unsigned long n)
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index ce08762..21ea40c 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -177,12 +177,12 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 #define nodma_mem_alloc(size) vdma_mem_alloc(size)
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
if((unsigned int) addr >= (unsigned int) high_memory)
-   return vfree((void *)addr);
+   return vfree(addr);
else
-   free_pages((void *)addr, get_order(size));  
+   free_pages(addr, get_order(size));  
 }
 
 #define fd_dma_mem_free(addr, size)  _fd_dma_mem_free(addr, size) 
diff --git a/arch/sparc/include/asm/floppy_32.h 
b/arch/sparc/include/asm/floppy_32.h
index 071b83e..dd7aa7c 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -75,7 +75,7 @@ static struct sun_floppy_ops sun_fdops;
 #define fd_free_irq() /* nothing... */
 #if 0  /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
 #define fd_dma_mem_alloc(size)((unsigned long) vmalloc(size))
-#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
+#define fd_dma_mem_free(addr,size) (vfree((addr)))
 #endif
 
 /* XXX This isn't really correct. XXX */
diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 8203e1d..31718b2 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -165,12 +165,12 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 #define nodma_mem_alloc(size) vdma_mem_alloc(size)
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
if ((unsigned long)addr >= (unsigned long)high_memory)
-   vfree((void *)addr);
+   vfree(addr);
else
-   free_pages((void *)addr, get_order(size));
+   free_pages(addr, get_order(size));
 }
 
 #define fd_dma_mem_free(addr, size)  _fd_dma_mem_free(addr, size)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index e2738be..9f36da8 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -267,7 +267,7 @@ static int set_next_request(void);
 /* Dma Memory related stuff */
 
 #ifndef fd_dma_mem_free
-#define fd_dma_mem_free(addr, size) free_pages((void *)addr, get_order(size))
+#define 

[POC][PATCH 21/83] c6x: remove unused macros

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/c6x/include/asm/processor.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/c6x/include/asm/processor.h b/arch/c6x/include/asm/processor.h
index b5b5a87..22f07a4 100644
--- a/arch/c6x/include/asm/processor.h
+++ b/arch/c6x/include/asm/processor.h
@@ -77,10 +77,6 @@ struct thread_struct {
 #define task_pt_regs(task) \
((struct pt_regs *)(THREAD_START_SP + task_stack_page(task)) - 1)
 
-#define alloc_kernel_stack()   __get_free_page(GFP_KERNEL)
-#define free_kernel_stack(page) free_page((void *)(page))
-
-
 /* Forward declaration, a strange C thing */
 struct task_struct;
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 22/83] [davinci] ccdc_update_raw_params() frees the wrong thing

2015-12-21 Thread Al Viro
From: Al Viro 

Passing a physical address to free_pages() is a bad idea.
config_params->fault_pxl.fpc_table_addr is set to virt_to_phys()
of __get_free_pages() return value; what we should pass to free_pages()
is its phys_to_virt().  ccdc_close() does that properly, but
ccdc_update_raw_params() doesn't.

Signed-off-by: Al Viro 
---
 drivers/media/platform/davinci/dm644x_ccdc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
b/drivers/media/platform/davinci/dm644x_ccdc.c
index 31d4015..42df06f 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -261,7 +261,7 @@ static int ccdc_update_raw_params(struct 
ccdc_config_params_raw *raw_params)
 */
if (raw_params->fault_pxl.fp_num != config_params->fault_pxl.fp_num) {
if (fpc_physaddr != NULL) {
-   free_pages(fpc_physaddr,
+   free_pages(fpc_virtaddr,
   get_order
   (config_params->fault_pxl.fp_num *
   FP_NUM_BYTES));
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 26/83] dma_4v_alloc_coherent(): don't mix virtual and physical addresses

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/sparc/kernel/pci_sun4v.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 3eb8907..3ea1937 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -151,8 +151,8 @@ static void *dma_4v_alloc_coherent(struct device *dev, 
size_t size,
if (unlikely(!page))
return NULL;
 
-   first_page = (unsigned long) page_address(page);
-   memset((char *)first_page, 0, PAGE_SIZE << order);
+   ret =  page_address(page);
+   memset(ret, 0, PAGE_SIZE << order);
 
iommu = dev->archdata.iommu;
 
@@ -163,8 +163,7 @@ static void *dma_4v_alloc_coherent(struct device *dev, 
size_t size,
goto range_alloc_fail;
 
*dma_addrp = (iommu->tbl.table_map_base + (entry << IO_PAGE_SHIFT));
-   ret = (void *) first_page;
-   first_page = __pa(first_page);
+   first_page = __pa(ret);
 
local_irq_save(flags);
 
@@ -190,7 +189,7 @@ iommu_map_fail:
iommu_tbl_range_free(>tbl, *dma_addrp, npages, IOMMU_ERROR_CODE);
 
 range_alloc_fail:
-   free_pages((void *)first_page, order);
+   free_pages(ret, order);
return NULL;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 2/5] Documentation: devicetree: Add DT bindings to eeprom_93xx46 driver.

2015-12-21 Thread Vladimir Zapolskiy
Hi Cory,

On 10.12.2015 06:00, Cory Tusar wrote:
> This commit documents bindings to be added to the eeprom_93xx46 driver
> which will allow:
> 
>   - Device word size and read-only attributes to be specified.
>   - A device-specific compatible string for use with Atmel AT93C46D
> EEPROMs.
>   - Specifying a GPIO line to function as a 'select' or 'enable' signal
> prior to accessing the EEPROM.
> 
> Signed-off-by: Cory Tusar 
> Acked-by: Rob Herring 
> Tested-by: Chris Healy 
> ---
>  .../devicetree/bindings/misc/eeprom-93xx46.txt | 25 
> ++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt 
> b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt
> new file mode 100644
> index 000..a8ebb46
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt
> @@ -0,0 +1,25 @@
> +EEPROMs (SPI) compatible with Microchip Technology 93xx46 family.
> +
> +Required properties:
> +- compatible : shall be one of:
> +"atmel,at93c46d"
> +"eeprom-93xx46"

the second compatible property value is not recommended by ePAPR, I would
suggest to remove it from here and from the example below.

But I see that Rob acked this change though...

> +- data-size : number of data bits per word (either 8 or 16)
> +
> +Optional properties:
> +- read-only : parameter-less property which disables writes to the EEPROM
> +- select-gpios : if present, specifies the GPIO that will be asserted prior 
> to
> +  each access to the EEPROM (e.g. for SPI bus multiplexing)
> +
> +Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
> +apply.  In particular, "reg" and "spi-max-frequency" properties must be 
> given.
> +
> +Example:
> + eeprom@0 {
> + compatible = "eeprom-93xx46";
> + reg = <0>;
> + spi-max-frequency = <100>;
> + spi-cs-high;
> + data-size = <8>;
> + select-gpios = < 4 GPIO_ACTIVE_HIGH>;
> + };
> 

--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 33/83] drivers/pci: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/pci/host/pci-tegra.c   | 10 +-
 drivers/pci/host/pcie-designware.c |  6 +++---
 drivers/pci/host/pcie-designware.h |  2 +-
 drivers/pci/host/pcie-rcar.c   |  6 +++---
 drivers/pci/host/pcie-xilinx.c | 10 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 9ad90fd..ba7fc9e 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -241,7 +241,7 @@ struct tegra_msi {
struct msi_controller chip;
DECLARE_BITMAP(used, INT_PCI_MSI_NR);
struct irq_domain *domain;
-   unsigned long pages;
+   void *pages;
struct mutex lock;
int irq;
 };
@@ -1214,7 +1214,7 @@ static int tegra_msi_setup_irq(struct msi_controller 
*chip,
 
irq_set_msi_desc(irq, desc);
 
-   msg.address_lo = virt_to_phys((void *)msi->pages);
+   msg.address_lo = virt_to_phys(msi->pages);
/* 32 bit address only */
msg.address_hi = 0;
msg.data = hwirq;
@@ -1296,8 +1296,8 @@ static int tegra_pcie_enable_msi(struct tegra_pcie *pcie)
}
 
/* setup AFI/FPCI range */
-   msi->pages = __get_free_pages(GFP_KERNEL, 0);
-   base = virt_to_phys((void *)msi->pages);
+   msi->pages = (void *)__get_free_pages(GFP_KERNEL, 0);
+   base = virt_to_phys(msi->pages);
 
afi_writel(pcie, base >> soc->msi_base_shift, AFI_MSI_FPCI_BAR_ST);
afi_writel(pcie, base, AFI_MSI_AXI_BAR_ST);
@@ -1347,7 +1347,7 @@ static int tegra_pcie_disable_msi(struct tegra_pcie *pcie)
afi_writel(pcie, 0, AFI_MSI_EN_VEC6);
afi_writel(pcie, 0, AFI_MSI_EN_VEC7);
 
-   free_pages((void *)msi->pages, 0);
+   free_pages(msi->pages, 0);
 
if (msi->irq > 0)
free_irq(msi->irq, pcie);
diff --git a/drivers/pci/host/pcie-designware.c 
b/drivers/pci/host/pcie-designware.c
index 02a7452..769fc9d 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -206,8 +206,8 @@ void dw_pcie_msi_init(struct pcie_port *pp)
 {
u64 msi_target;
 
-   pp->msi_data = __get_free_pages(GFP_KERNEL, 0);
-   msi_target = virt_to_phys((void *)pp->msi_data);
+   pp->msi_data = (void *)__get_free_pages(GFP_KERNEL, 0);
+   msi_target = virt_to_phys(pp->msi_data);
 
/* program the msi_data */
dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4,
@@ -307,7 +307,7 @@ static void dw_msi_setup_msg(struct pcie_port *pp, unsigned 
int irq, u32 pos)
if (pp->ops->get_msi_addr)
msi_target = pp->ops->get_msi_addr(pp);
else
-   msi_target = virt_to_phys((void *)pp->msi_data);
+   msi_target = virt_to_phys(pp->msi_data);
 
msg.address_lo = (u32)(msi_target & 0x);
msg.address_hi = (u32)(msi_target >> 32 & 0x);
diff --git a/drivers/pci/host/pcie-designware.h 
b/drivers/pci/host/pcie-designware.h
index 2356d29..c77704b 100644
--- a/drivers/pci/host/pcie-designware.h
+++ b/drivers/pci/host/pcie-designware.h
@@ -47,7 +47,7 @@ struct pcie_port {
struct pcie_host_ops*ops;
int msi_irq;
struct irq_domain   *irq_domain;
-   unsigned long   msi_data;
+   void*msi_data;
DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
 };
 
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index f4fa6c5..fdeb72f 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -114,7 +114,7 @@ struct rcar_msi {
DECLARE_BITMAP(used, INT_PCI_MSI_NR);
struct irq_domain *domain;
struct msi_controller chip;
-   unsigned long pages;
+   void *pages;
struct mutex lock;
int irq1;
int irq2;
@@ -734,8 +734,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
}
 
/* setup MSI data target */
-   msi->pages = __get_free_pages(GFP_KERNEL, 0);
-   base = virt_to_phys((void *)msi->pages);
+   msi->pages = (void *)__get_free_pages(GFP_KERNEL, 0);
+   base = virt_to_phys(msi->pages);
 
rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
rcar_pci_write_reg(pcie, 0, PCIEMSIAUR);
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index a9438d2..3cc679d 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -111,7 +111,7 @@
 struct xilinx_pcie_port {
void __iomem *reg_base;
u32 irq;
-   unsigned long msi_pages;
+   void *msi_pages;
u8 root_busno;
struct device *dev;
struct irq_domain *irq_domain;
@@ -297,7 +297,7 @@ static int xilinx_pcie_msi_setup_irq(struct msi_controller 
*chip,
 
irq_set_msi_desc(irq, desc);
 
-   msg_addr = virt_to_phys((void *)port->msi_pages);
+   msg_addr = virt_to_phys(port->msi_pages);
 

[POC][PATCH 29/83] switch the remaining users of __get_dma_pages() to get_dma_pages()

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/char/mbcs.c  | 24 
 drivers/net/appletalk/ltpc.c |  8 +++-
 drivers/net/ethernet/amd/mvme147.c   |  8 
 drivers/net/ethernet/cirrus/cs89x0.c |  3 +--
 include/linux/gfp.h  |  3 ---
 5 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c
index b9d9619..eddf892 100644
--- a/drivers/char/mbcs.c
+++ b/drivers/char/mbcs.c
@@ -404,22 +404,22 @@ static ssize_t mbcs_sram_read(struct file * fp, char 
__user *buf, size_t len, lo
 {
struct cx_dev *cx_dev = fp->private_data;
struct mbcs_soft *soft = cx_dev->soft;
-   uint64_t hostAddr;
+   void *hostAddr;
int rv = 0;
 
-   hostAddr = __get_dma_pages(GFP_KERNEL, get_order(len));
-   if (hostAddr == 0)
+   hostAddr = get_dma_pages(GFP_KERNEL, get_order(len));
+   if (!hostAddr)
return -ENOMEM;
 
-   rv = do_mbcs_sram_dmawrite(soft, hostAddr, len, off);
+   rv = do_mbcs_sram_dmawrite(soft, (unsigned long)hostAddr, len, off);
if (rv < 0)
goto exit;
 
-   if (copy_to_user(buf, (void *)hostAddr, len))
+   if (copy_to_user(buf, hostAddr, len))
rv = -EFAULT;
 
   exit:
-   free_pages((void *)hostAddr, get_order(len));
+   free_pages(hostAddr, get_order(len));
 
return rv;
 }
@@ -429,22 +429,22 @@ mbcs_sram_write(struct file * fp, const char __user *buf, 
size_t len, loff_t * o
 {
struct cx_dev *cx_dev = fp->private_data;
struct mbcs_soft *soft = cx_dev->soft;
-   uint64_t hostAddr;
+   void *hostAddr;
int rv = 0;
 
-   hostAddr = __get_dma_pages(GFP_KERNEL, get_order(len));
-   if (hostAddr == 0)
+   hostAddr = get_dma_pages(GFP_KERNEL, get_order(len));
+   if (!hostAddr)
return -ENOMEM;
 
-   if (copy_from_user((void *)hostAddr, buf, len)) {
+   if (copy_from_user(hostAddr, buf, len)) {
rv = -EFAULT;
goto exit;
}
 
-   rv = do_mbcs_sram_dmaread(soft, hostAddr, len, off);
+   rv = do_mbcs_sram_dmaread(soft, (unsigned long)hostAddr, len, off);
 
   exit:
-   free_pages((void *)hostAddr, get_order(len));
+   free_pages(hostAddr, get_order(len));
 
return rv;
 }
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index c98dea0..daaffd7 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -245,11 +245,9 @@ static int sendup_buffer (struct net_device *dev);
 
 /* Dma Memory related stuff, cribbed directly from 3c505.c */
 
-static unsigned long dma_mem_alloc(int size)
+static void *dma_mem_alloc(int size)
 {
-int order = get_order(size);
-
-return __get_dma_pages(GFP_KERNEL, order);
+return get_dma_pages(GFP_KERNEL, get_order(size));
 }
 
 /* DMA data buffer, DMA command buffer */
@@ -1075,7 +1073,7 @@ struct net_device * __init ltpc_probe(void)
}
 
/* allocate a DMA buffer */
-   ltdmabuf = (unsigned char *) dma_mem_alloc(1000);
+   ltdmabuf = dma_mem_alloc(1000);
if (!ltdmabuf) {
printk(KERN_ERR "ltpc: mem alloc failed\n");
err = -ENOMEM;
diff --git a/drivers/net/ethernet/amd/mvme147.c 
b/drivers/net/ethernet/amd/mvme147.c
index abda91c..b3487fb 100644
--- a/drivers/net/ethernet/amd/mvme147.c
+++ b/drivers/net/ethernet/amd/mvme147.c
@@ -38,7 +38,7 @@
 /* Our private data structure */
 struct m147lance_private {
struct lance_private lance;
-   unsigned long ram;
+   void *ram;
 };
 
 /* function prototypes... This is easy because all the grot is in the
@@ -111,7 +111,7 @@ struct net_device * __init mvme147lance_probe(int unit)
   dev->dev_addr);
 
lp = netdev_priv(dev);
-   lp->ram = __get_dma_pages(GFP_ATOMIC, 3);   /* 32K */
+   lp->ram = get_dma_pages(GFP_ATOMIC, 3); /* 32K */
if (!lp->ram) {
printk("%s: No memory for LANCE buffers\n", dev->name);
free_netdev(dev);
@@ -134,7 +134,7 @@ struct net_device * __init mvme147lance_probe(int unit)
 
err = register_netdev(dev);
if (err) {
-   free_pages((void *)lp->ram, 3);
+   free_pages(lp->ram, 3);
free_netdev(dev);
return ERR_PTR(err);
}
@@ -193,7 +193,7 @@ void __exit cleanup_module(void)
 {
struct m147lance_private *lp = netdev_priv(dev_mvme147_lance);
unregister_netdev(dev_mvme147_lance);
-   free_pages((void *)lp->ram, 3);
+   free_pages(lp->ram, 3);
free_netdev(dev_mvme147_lance);
 }
 
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c 
b/drivers/net/ethernet/cirrus/cs89x0.c
index 815c596..25e128f 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -883,8 +883,7 @@ net_open(struct net_device *dev)
 #if 

[POC][PATCH 32/83] lguest: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/lguest/lg.h  | 2 +-
 drivers/lguest/lguest_user.c | 8 
 drivers/lguest/page_tables.c | 8 
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index ac8ad04..3334ca0 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -56,7 +56,7 @@ struct lg_cpu {
unsigned long *reg_read; /* register from LHREQ_GETREG */
 
/* At end of a page shared mapped over lguest_pages in guest. */
-   unsigned long regs_page;
+   void *regs_page;
struct lguest_regs *regs;
 
struct lguest_pages *last_pages;
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index fe2e859..dac142b 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -170,12 +170,12 @@ static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, 
unsigned long start_ip)
 * We need a complete page for the Guest registers: they are accessible
 * to the Guest and we can only grant it access to whole pages.
 */
-   cpu->regs_page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   cpu->regs_page = get_zeroed_page(GFP_KERNEL);
if (!cpu->regs_page)
return -ENOMEM;
 
/* We actually put the registers at the end of the page. */
-   cpu->regs = (void *)cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs);
+   cpu->regs = cpu->regs_page + PAGE_SIZE - sizeof(*cpu->regs);
 
/*
 * Now we initialize the Guest's registers, handing it the start
@@ -275,7 +275,7 @@ static int initialize(struct file *file, const unsigned 
long __user *input)
 
 free_regs:
/* FIXME: This should be in free_vcpu */
-   free_page((void *)lg->cpus[0].regs_page);
+   free_page(lg->cpus[0].regs_page);
 free_lg:
kfree(lg);
 unlock:
@@ -377,7 +377,7 @@ static int close(struct inode *inode, struct file *file)
/* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
hrtimer_cancel(>cpus[i].hrt);
/* We can free up the register page we allocated. */
-   free_page((void *)lg->cpus[i].regs_page);
+   free_page(lg->cpus[i].regs_page);
/*
 * Now all the memory cleanups are done, it's safe to release
 * the Launcher's memory management structure.
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index de1c8ac..f476c93 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -313,13 +313,13 @@ static pte_t *find_spte(struct lg_cpu *cpu, unsigned long 
vaddr, bool allocate,
spgd = spgd_addr(cpu, cpu->cpu_pgd, vaddr);
if (!(pgd_flags(*spgd) & _PAGE_PRESENT)) {
/* No shadow entry: allocate a new shadow PTE page. */
-   unsigned long ptepage;
+   pte_t *ptepage;
 
/* If they didn't want us to allocate anything, stop. */
if (!allocate)
return NULL;
 
-   ptepage = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   ptepage = get_zeroed_page(GFP_KERNEL);
/*
 * This is not really the Guest's fault, but killing it is
 * simple for this corner case.
@@ -345,13 +345,13 @@ static pte_t *find_spte(struct lg_cpu *cpu, unsigned long 
vaddr, bool allocate,
 
if (!(pmd_flags(*spmd) & _PAGE_PRESENT)) {
/* No shadow entry: allocate a new shadow PTE page. */
-   unsigned long ptepage;
+   pte_t *ptepage;
 
/* If they didn't want us to allocate anything, stop. */
if (!allocate)
return NULL;
 
-   ptepage = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   ptepage = get_zeroed_page(GFP_KERNEL);
 
/*
 * This is not really the Guest's fault, but killing it is
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 20/83] staging/rdma: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/staging/rdma/ehca/ehca_pd.c   | 2 +-
 drivers/staging/rdma/ehca/ipz_pt_fn.c | 6 +++---
 drivers/staging/rdma/ehca/ipz_pt_fn.h | 2 +-
 drivers/staging/rdma/hfi1/qp.c| 6 +++---
 drivers/staging/rdma/ipath/ipath_qp.c | 6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rdma/ehca/ehca_pd.c 
b/drivers/staging/rdma/ehca/ehca_pd.c
index c3424f4..351577a 100644
--- a/drivers/staging/rdma/ehca/ehca_pd.c
+++ b/drivers/staging/rdma/ehca/ehca_pd.c
@@ -92,7 +92,7 @@ int ehca_dealloc_pd(struct ib_pd *pd)
list_splice(_pd->full[i], _pd->free[i]);
list_for_each_entry_safe(page, tmp, _pd->free[i], list) {
leftovers = 1;
-   free_page((void *)page->page);
+   free_page(page->page);
kmem_cache_free(small_qp_cache, page);
}
}
diff --git a/drivers/staging/rdma/ehca/ipz_pt_fn.c 
b/drivers/staging/rdma/ehca/ipz_pt_fn.c
index 267df34..94deabc 100644
--- a/drivers/staging/rdma/ehca/ipz_pt_fn.c
+++ b/drivers/staging/rdma/ehca/ipz_pt_fn.c
@@ -140,7 +140,7 @@ static int alloc_small_queue_page(struct ipz_queue *queue, 
struct ehca_pd *pd)
if (!page)
goto out;
 
-   page->page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page->page = get_zeroed_page(GFP_KERNEL);
if (!page->page) {
kmem_cache_free(small_qp_cache, page);
goto out;
@@ -158,7 +158,7 @@ static int alloc_small_queue_page(struct ipz_queue *queue, 
struct ehca_pd *pd)
 
mutex_unlock(>lock);
 
-   queue->queue_pages[0] = (void *)(page->page | (bit << (order + 9)));
+   queue->queue_pages[0] = page->page + (bit << (order + 9));
queue->small_page = page;
queue->offset = bit << (order + 9);
return 1;
@@ -196,7 +196,7 @@ static void free_small_queue_page(struct ipz_queue *queue, 
struct ehca_pd *pd)
mutex_unlock(>lock);
 
if (free_page) {
-   free_page((void *)page->page);
+   free_page(page->page);
kmem_cache_free(small_qp_cache, page);
}
 }
diff --git a/drivers/staging/rdma/ehca/ipz_pt_fn.h 
b/drivers/staging/rdma/ehca/ipz_pt_fn.h
index a801274..e695ed2 100644
--- a/drivers/staging/rdma/ehca/ipz_pt_fn.h
+++ b/drivers/staging/rdma/ehca/ipz_pt_fn.h
@@ -64,7 +64,7 @@ struct ipz_page {
 #define IPZ_SPAGE_PER_KPAGE (PAGE_SIZE / 512)
 
 struct ipz_small_queue_page {
-   unsigned long page;
+   void *page;
unsigned long bitmap[IPZ_SPAGE_PER_KPAGE / BITS_PER_LONG];
int fill;
void *mapped_addr;
diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index 4445610..701249d 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -120,7 +120,7 @@ static const u16 credit_table[31] = {
 
 static void get_map_page(struct hfi1_qpn_table *qpt, struct qpn_map *map)
 {
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   void *page = get_zeroed_page(GFP_KERNEL);
 
/*
 * Free the page if someone raced with us installing it.
@@ -128,9 +128,9 @@ static void get_map_page(struct hfi1_qpn_table *qpt, struct 
qpn_map *map)
 
spin_lock(>lock);
if (map->page)
-   free_page((void *)page);
+   free_page(page);
else
-   map->page = (void *)page;
+   map->page = page;
spin_unlock(>lock);
 }
 
diff --git a/drivers/staging/rdma/ipath/ipath_qp.c 
b/drivers/staging/rdma/ipath/ipath_qp.c
index 51fa380..b4ed2ef 100644
--- a/drivers/staging/rdma/ipath/ipath_qp.c
+++ b/drivers/staging/rdma/ipath/ipath_qp.c
@@ -85,7 +85,7 @@ static u32 credit_table[31] = {
 
 static void get_map_page(struct ipath_qp_table *qpt, struct qpn_map *map)
 {
-   unsigned long page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   void *page = get_zeroed_page(GFP_KERNEL);
unsigned long flags;
 
/*
@@ -94,9 +94,9 @@ static void get_map_page(struct ipath_qp_table *qpt, struct 
qpn_map *map)
 
spin_lock_irqsave(>lock, flags);
if (map->page)
-   free_page((void *)page);
+   free_page(page);
else
-   map->page = (void *)page;
+   map->page = page;
spin_unlock_irqrestore(>lock, flags);
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] free_pages stuff

2015-12-21 Thread Linus Torvalds
On Mon, Dec 21, 2015 at 3:46 PM, Al Viro  wrote:
> FWIW, I'd done a proof-of-concept patch series converting the things
> to
> * free_page() and free_pages() taking the address to free as a pointer
> * get_zeroed_page() returning a pointer
> * get_free_page()/get_free_pages() added, both returning a pointer
> * __get_dma_pages() replaced with get_dma_page() (again, returns
> a pointer)

Absolutely not.

I will not take this, and it's stupid in the extreme.

No way in hell do we suddenly change the semantics of an interface
that has been around from basically day #1. That's just crazy talk.

Just looking at the diffstat should have made you realize that this is
stupid. The confusion it causes, the pain it causes for backports, and
just the fundamental idiocy of changing an long-standing interface
without changing the name is just not acceptable.

If you want to have versions of the function that return pointers, you
had damn well better give them new names. Not use the same name for a
different function, causing confusion and forcing this kind of crazy
"change everything at once" flag-day patches, and pain for
backporting.

And quite frankly, even the "new name" is likely a bad idea. If you
want to allocate a page, and get a pointer, just use "kmalloc()".
Boom, done!

So I don't know how many ways I can say "NO", but I'll not take
anythign like this. It's *completely* wrong.

 Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 31/83] efficeon: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/char/agp/efficeon-agp.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index c3d0d44..d64e601 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -57,7 +57,7 @@
 #define EFFICEON_PRESENT   (1 << 8)
 
 static struct _efficeon_private {
-   unsigned long l1_table[EFFICEON_L1_SIZE];
+   unsigned int *l1_table[EFFICEON_L1_SIZE];
 } efficeon_private;
 
 static const struct gatt_mask efficeon_generic_masks[] =
@@ -160,11 +160,11 @@ static int efficeon_free_gatt_table(struct 
agp_bridge_data *bridge)
int index, freed = 0;
 
for (index = 0; index < EFFICEON_L1_SIZE; index++) {
-   unsigned long page = efficeon_private.l1_table[index];
+   void *page = efficeon_private.l1_table[index];
if (page) {
-   efficeon_private.l1_table[index] = 0;
-   ClearPageReserved(virt_to_page((char *)page));
-   free_page((void *)page);
+   efficeon_private.l1_table[index] = NULL;
+   ClearPageReserved(virt_to_page(page));
+   free_page(page);
freed++;
}
printk(KERN_DEBUG PFX "efficeon_free_gatt_table(%p, %02x, 
%08x)\n",
@@ -208,25 +208,25 @@ static int efficeon_create_gatt_table(struct 
agp_bridge_data *bridge)
 
for (index = 0 ; index < l1_pages ; index++) {
int offset;
-   unsigned long page;
+   void *page;
unsigned long value;
 
page = efficeon_private.l1_table[index];
BUG_ON(page);
 
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page) {
efficeon_free_gatt_table(agp_bridge);
return -ENOMEM;
}
-   SetPageReserved(virt_to_page((char *)page));
+   SetPageReserved(virt_to_page(page));
 
for (offset = 0; offset < PAGE_SIZE; offset += clflush_chunk)
-   clflush((char *)page+offset);
+   clflush(page+offset);
 
efficeon_private.l1_table[index] = page;
 
-   value = virt_to_phys((unsigned long *)page) | pati | present | 
index;
+   value = virt_to_phys(page) | pati | present | index;
 
pci_write_config_dword(agp_bridge->dev,
EFFICEON_ATTPAGE, value);
@@ -260,7 +260,7 @@ static int efficeon_insert_memory(struct agp_memory * mem, 
off_t pg_start, int t
int index = pg_start + i;
unsigned long insert = efficeon_mask_memory(mem->pages[i]);
 
-   page = (unsigned int *) efficeon_private.l1_table[index >> 10];
+   page = efficeon_private.l1_table[index >> 10];
 
if (!page)
continue;
@@ -299,7 +299,7 @@ static int efficeon_remove_memory(struct agp_memory * mem, 
off_t pg_start, int t
 
for (i = 0; i < count; i++) {
int index = pg_start + i;
-   unsigned int *page = (unsigned int *) 
efficeon_private.l1_table[index >> 10];
+   unsigned int *page = efficeon_private.l1_table[index >> 10];
 
if (!page)
continue;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 27/83] new helper: get_dma_pages()

2015-12-21 Thread Al Viro
From: Al Viro 

same as __get_dma_pages(), except that it returns a pointer

Signed-off-by: Al Viro 
---
 include/linux/gfp.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index f4304c1..07b714d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -486,6 +486,9 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t 
size, gfp_t gfp_mask);
 #define __get_dma_pages(gfp_mask, order) \
__get_free_pages((gfp_mask) | GFP_DMA, (order))
 
+#define get_dma_pages(gfp_mask, order) \
+   ((void *)__get_free_pages((gfp_mask) | GFP_DMA, (order)))
+
 extern void __free_pages(struct page *page, unsigned int order);
 extern void free_pages(const void *addr, unsigned int order);
 extern void free_hot_cold_page(struct page *page, bool cold);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 28/83] make fd_dma_mem_alloc/nodma_mem_alloc return a pointer

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/m68k/include/asm/floppy.h  |  4 ++--
 arch/mips/include/asm/mach-generic/floppy.h |  8 ++--
 arch/mips/include/asm/mach-jazz/floppy.h| 10 --
 arch/parisc/include/asm/floppy.h| 15 +--
 arch/sparc/include/asm/floppy_32.h  |  2 +-
 arch/x86/include/asm/floppy.h   | 15 +--
 drivers/block/floppy.c  | 10 +-
 7 files changed, 24 insertions(+), 40 deletions(-)

diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h
index b5fb689..44f85da 100644
--- a/arch/m68k/include/asm/floppy.h
+++ b/arch/m68k/include/asm/floppy.h
@@ -141,9 +141,9 @@ static int vdma_get_dma_residue(unsigned int dummy)
 }
 
 
-static unsigned long vdma_mem_alloc(unsigned long size)
+static void *vdma_mem_alloc(unsigned long size)
 {
-   return (unsigned long) vmalloc(size);
+   return vmalloc(size);
 
 }
 
diff --git a/arch/mips/include/asm/mach-generic/floppy.h 
b/arch/mips/include/asm/mach-generic/floppy.h
index 1419f0d..5b4087f 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -113,13 +113,9 @@ static inline unsigned long fd_getfdaddr1(void)
return 0x3f0;
 }
 
-static inline unsigned long fd_dma_mem_alloc(unsigned long size)
+static inline void *fd_dma_mem_alloc(unsigned long size)
 {
-   unsigned long mem;
-
-   mem = __get_dma_pages(GFP_KERNEL, get_order(size));
-
-   return mem;
+   return get_dma_pages(GFP_KERNEL, get_order(size));
 }
 
 static inline void fd_dma_mem_free(void *addr, unsigned long size)
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h 
b/arch/mips/include/asm/mach-jazz/floppy.h
index 701dbfc..8aa7b85 100644
--- a/arch/mips/include/asm/mach-jazz/floppy.h
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -102,14 +102,12 @@ static inline unsigned long fd_getfdaddr1(void)
return JAZZ_FDC_BASE;
 }
 
-static inline unsigned long fd_dma_mem_alloc(unsigned long size)
+static inline void *fd_dma_mem_alloc(unsigned long size)
 {
-   unsigned long mem;
+   void *mem = get_dma_pages(GFP_KERNEL, get_order(size));
 
-   mem = __get_dma_pages(GFP_KERNEL, get_order(size));
-   if(!mem)
-   return 0;
-   vdma_alloc(CPHYSADDR(mem), size);   /* XXX error checking */
+   if (mem)/* XXX error checking */
+   vdma_alloc(CPHYSADDR((unsigned long)mem), size);
 
return mem;
 }
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index 21ea40c..92bb8c8 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -163,19 +163,14 @@ static int fd_request_irq(void)
   0, "floppy", NULL);
 }
 
-static unsigned long dma_mem_alloc(unsigned long size)
+static void *dma_mem_alloc(unsigned long size)
 {
-   return __get_dma_pages(GFP_KERNEL, get_order(size));
+   return get_dma_pages(GFP_KERNEL, get_order(size));
 }
 
 
-static unsigned long vdma_mem_alloc(unsigned long size)
-{
-   return (unsigned long) vmalloc(size);
-
-}
-
-#define nodma_mem_alloc(size) vdma_mem_alloc(size)
+#define vdma_mem_alloc vmalloc
+#define nodma_mem_alloc vmalloc
 
 static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
@@ -237,7 +232,7 @@ static struct fd_routine_l {
int (*_request_dma)(unsigned int dmanr, const char * device_id);
void (*_free_dma)(unsigned int dmanr);
int (*_get_dma_residue)(unsigned int dummy);
-   unsigned long (*_dma_mem_alloc) (unsigned long size);
+   void *(*_dma_mem_alloc) (unsigned long size);
int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
 } fd_routine[] = {
{
diff --git a/arch/sparc/include/asm/floppy_32.h 
b/arch/sparc/include/asm/floppy_32.h
index dd7aa7c..6e33911 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -74,7 +74,7 @@ static struct sun_floppy_ops sun_fdops;
 #define fd_request_irq()  sun_fd_request_irq()
 #define fd_free_irq() /* nothing... */
 #if 0  /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
-#define fd_dma_mem_alloc(size)((unsigned long) vmalloc(size))
+#define fd_dma_mem_alloc(size)(vmalloc(size))
 #define fd_dma_mem_free(addr,size) (vfree((addr)))
 #endif
 
diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 31718b2..1ace831 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -151,19 +151,14 @@ static int fd_request_irq(void)
   0, "floppy", NULL);
 }
 
-static unsigned long dma_mem_alloc(unsigned long size)
+static void *dma_mem_alloc(unsigned long size)
 {
-   return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY, get_order(size));
+   return get_dma_pages(GFP_KERNEL|__GFP_NORETRY, get_order(size));
 }
 
 
-static 

[POC][PATCH 30/83] sparc: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/sparc/include/asm/dma.h  |  2 +-
 arch/sparc/include/asm/iommu_64.h |  2 +-
 arch/sparc/kernel/iommu.c |  8 
 arch/sparc/kernel/ioport.c|  8 
 arch/sparc/kernel/irq_64.c|  4 ++--
 arch/sparc/kernel/pci_fire.c  | 18 --
 arch/sparc/kernel/pci_sun4v.c | 24 +---
 arch/sparc/mm/io-unit.c   |  9 -
 arch/sparc/mm/iommu.c | 10 +-
 9 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/arch/sparc/include/asm/dma.h b/arch/sparc/include/asm/dma.h
index 3d434ef..9bf9f53 100644
--- a/arch/sparc/include/asm/dma.h
+++ b/arch/sparc/include/asm/dma.h
@@ -101,7 +101,7 @@ struct sparc32_dma_ops {
void (*release_scsi_one)(struct device *, __u32, unsigned long);
void (*release_scsi_sgl)(struct device *, struct scatterlist *,int);
 #ifdef CONFIG_SBUS
-   int (*map_dma_area)(struct device *, dma_addr_t *, unsigned long, 
unsigned long, int);
+   int (*map_dma_area)(struct device *, dma_addr_t *, void *, unsigned 
long, int);
void (*unmap_dma_area)(struct device *, unsigned long, int);
 #endif
 };
diff --git a/arch/sparc/include/asm/iommu_64.h 
b/arch/sparc/include/asm/iommu_64.h
index cd0d69f..e781f29 100644
--- a/arch/sparc/include/asm/iommu_64.h
+++ b/arch/sparc/include/asm/iommu_64.h
@@ -36,7 +36,7 @@ struct iommu {
unsigned long   iommu_tags;
unsigned long   iommu_ctxflush;
unsigned long   write_complete_reg;
-   unsigned long   dummy_page;
+   void*dummy_page;
unsigned long   dummy_page_pa;
unsigned long   ctx_lowest_free;
DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS);
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 18a40c6..47c2822 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -124,8 +124,8 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n");
goto out_free_map;
}
-   iommu->dummy_page = (unsigned long) page_address(page);
-   memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
+   iommu->dummy_page = page_address(page);
+   memset(iommu->dummy_page, 0, PAGE_SIZE);
iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
 
/* Now allocate and setup the IOMMU page table itself.  */
@@ -143,8 +143,8 @@ int iommu_table_init(struct iommu *iommu, int tsbsize,
return 0;
 
 out_free_dummy_page:
-   free_page((void *)iommu->dummy_page);
-   iommu->dummy_page = 0UL;
+   free_page(iommu->dummy_page);
+   iommu->dummy_page = NULL;
 
 out_free_map:
kfree(iommu->tbl.map);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 39b406a..3bd3481 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -264,7 +264,7 @@ static void *sbus_alloc_coherent(struct device *dev, size_t 
len,
 {
struct platform_device *op = to_platform_device(dev);
unsigned long len_total = PAGE_ALIGN(len);
-   unsigned long va;
+   void *va;
struct resource *res;
int order;
 
@@ -278,8 +278,8 @@ static void *sbus_alloc_coherent(struct device *dev, size_t 
len,
}
 
order = get_order(len_total);
-   va = __get_free_pages(gfp, order);
-   if (va == 0)
+   va = (void *)__get_free_pages(gfp, order);
+   if (!va)
goto err_nopages;
 
if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
@@ -309,7 +309,7 @@ err_noiommu:
 err_nova:
kfree(res);
 err_nomem:
-   free_pages((void *)va, order);
+   free_pages(va, order);
 err_nopages:
return NULL;
 }
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 24847b2..e2d198d 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -1033,11 +1033,11 @@ static void __init alloc_one_queue(unsigned long 
*pa_ptr, unsigned long qmask)
 static void __init init_cpu_send_mondo_info(struct trap_per_cpu *tb)
 {
 #ifdef CONFIG_SMP
-   unsigned long page;
+   void *page;
 
BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64));
 
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page) {
prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n");
prom_halt();
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index b8ac1bb..ff44386 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -228,17 +228,18 @@ static int pci_fire_msi_teardown(struct pci_pbm_info 
*pbm, unsigned long msi)
 
 static int pci_fire_msiq_alloc(struct pci_pbm_info *pbm)
 {
-   unsigned long pages, order, i;
+   unsigned long order, i;
+   

[POC][PATCH 35/83] s390 kvm: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/s390/kvm/priv.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index af22195..93963ff 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -504,7 +504,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
int fc = (vcpu->run->s.regs.gprs[0] & 0xf000) >> 28;
int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
int sel2 = vcpu->run->s.regs.gprs[1] & 0x;
-   unsigned long mem = 0;
+   void *mem = NULL;
u64 operand2;
int rc = 0;
ar_t ar;
@@ -538,23 +538,23 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
switch (fc) {
case 1: /* same handling for 1 and 2 */
case 2:
-   mem = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   mem = get_zeroed_page(GFP_KERNEL);
if (!mem)
goto out_no_data;
-   if (stsi((void *) mem, fc, sel1, sel2))
+   if (stsi(mem, fc, sel1, sel2))
goto out_no_data;
break;
case 3:
if (sel1 != 2 || sel2 != 2)
goto out_no_data;
-   mem = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   mem = get_zeroed_page(GFP_KERNEL);
if (!mem)
goto out_no_data;
-   handle_stsi_3_2_2(vcpu, (void *) mem);
+   handle_stsi_3_2_2(vcpu, mem);
break;
}
 
-   rc = write_guest(vcpu, operand2, ar, (void *)mem, PAGE_SIZE);
+   rc = write_guest(vcpu, operand2, ar, mem, PAGE_SIZE);
if (rc) {
rc = kvm_s390_inject_prog_cond(vcpu, rc);
goto out;
@@ -564,14 +564,14 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
rc = -EREMOTE;
}
trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
-   free_page((void *)mem);
+   free_page(mem);
kvm_s390_set_psw_cc(vcpu, 0);
vcpu->run->s.regs.gprs[0] = 0;
return rc;
 out_no_data:
kvm_s390_set_psw_cc(vcpu, 3);
 out:
-   free_page((void *)mem);
+   free_page(mem);
return rc;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 34/83] drivers/s390: ger rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/s390/block/xpram.c| 24 
 drivers/s390/char/sclp_ftp.c  | 10 +-
 drivers/s390/cio/qdio.h   |  2 +-
 drivers/s390/cio/qdio_main.c  |  2 +-
 drivers/s390/cio/qdio_setup.c |  4 ++--
 drivers/s390/cio/qdio_thinint.c   |  2 +-
 drivers/s390/net/qeth_core_main.c |  4 ++--
 7 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 542c6d0..87d13a6 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -87,7 +87,7 @@ MODULE_LICENSE("GPL");
  *   -EIO: if pgin failed
  *   -ENXIO:   if xpram has vanished
  */
-static int xpram_page_in (unsigned long page_addr, unsigned int xpage_index)
+static int xpram_page_in (void *page_addr, unsigned int xpage_index)
 {
int cc = 2; /* return unused cc 2 if pgin traps */
 
@@ -117,7 +117,7 @@ static int xpram_page_in (unsigned long page_addr, unsigned 
int xpage_index)
  *   -EIO: if pgout failed
  *   -ENXIO:   if xpram has vanished
  */
-static long xpram_page_out (unsigned long page_addr, unsigned int xpage_index)
+static long xpram_page_out (void *page_addr, unsigned int xpage_index)
 {
int cc = 2; /* return unused cc 2 if pgin traps */
 
@@ -142,14 +142,14 @@ static long xpram_page_out (unsigned long page_addr, 
unsigned int xpage_index)
  */
 static int xpram_present(void)
 {
-   unsigned long mem_page;
+   void *mem_page;
int rc;
 
-   mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
+   mem_page = (void *)__get_free_page(GFP_KERNEL);
if (!mem_page)
return -ENOMEM;
rc = xpram_page_in(mem_page, 0);
-   free_page((void *)mem_page);
+   free_page(mem_page);
return rc ? -ENXIO : 0;
 }
 
@@ -159,9 +159,9 @@ static int xpram_present(void)
 static unsigned long xpram_highest_page_index(void)
 {
unsigned int page_index, add_bit;
-   unsigned long mem_page;
+   void *mem_page;
 
-   mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
+   mem_page = (void *) __get_free_page(GFP_KERNEL);
if (!mem_page)
return 0;
 
@@ -173,7 +173,7 @@ static unsigned long xpram_highest_page_index(void)
add_bit >>= 1;
}
 
-   free_page((void *)mem_page);
+   free_page(mem_page);
 
return page_index;
 }
@@ -187,7 +187,7 @@ static blk_qc_t xpram_make_request(struct request_queue *q, 
struct bio *bio)
struct bio_vec bvec;
struct bvec_iter iter;
unsigned int index;
-   unsigned long page_addr;
+   void *page_addr;
unsigned long bytes;
 
blk_queue_split(q, , q->bio_split);
@@ -203,10 +203,10 @@ static blk_qc_t xpram_make_request(struct request_queue 
*q, struct bio *bio)
goto fail;
index = (bio->bi_iter.bi_sector >> 3) + xdev->offset;
bio_for_each_segment(bvec, bio, iter) {
-   page_addr = (unsigned long)
-   kmap(bvec.bv_page) + bvec.bv_offset;
+   page_addr = kmap(bvec.bv_page) + bvec.bv_offset;
bytes = bvec.bv_len;
-   if ((page_addr & 4095) != 0 || (bytes & 4095) != 0)
+   if (((unsigned long)page_addr & 4095) != 0 ||
+   (bytes & 4095) != 0)
/* More paranoia. */
goto fail;
while (bytes > 0) {
diff --git a/drivers/s390/char/sclp_ftp.c b/drivers/s390/char/sclp_ftp.c
index 726e736..4de9d40 100644
--- a/drivers/s390/char/sclp_ftp.c
+++ b/drivers/s390/char/sclp_ftp.c
@@ -239,7 +239,7 @@ static struct sclp_register sclp_ftp_event = {
 int sclp_ftp_startup(void)
 {
 #ifdef DEBUG
-   unsigned long info;
+   void *info;
 #endif
int rc;
 
@@ -248,10 +248,10 @@ int sclp_ftp_startup(void)
return rc;
 
 #ifdef DEBUG
-   info = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   info = get_zeroed_page(GFP_KERNEL);
 
-   if (info != 0) {
-   struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info;
+   if (info) {
+   struct sysinfo_2_2_2 *info222 = info;
 
if (!stsi(info222, 2, 2, 2)) { /* get SYSIB 2.2.2 */
info222->name[sizeof(info222->name) - 1] = '\0';
@@ -260,7 +260,7 @@ int sclp_ftp_startup(void)
 info222->lpar_number, info222->name);
}
 
-   free_page((void *)info);
+   free_page(info);
}
 #endif /* DEBUG */
return 0;
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 7e70f92..6551443 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -300,7 +300,7 @@ struct qdio_irq {
int perf_stat_enabled;
 
struct qdr *qdr;
-   unsigned long chsc_page;
+   void *chsc_page;
 
   

Re: [PATCH] Staging: comedi: fix block comments coding style issue in comedi.h

2015-12-21 Thread Greg KH
On Mon, Dec 14, 2015 at 03:41:10PM +0800, maomao xu wrote:
> Fix up block comments to make a trailing */ on a separate line
> 
> Signed-off-by: maomao xu 
> ---
>  drivers/staging/comedi/comedi.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Doesn't apply to my tree :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] comedi/comedilib.h: cleanup coding style

2015-12-21 Thread Greg KH
On Tue, Dec 15, 2015 at 12:34:11AM +0400, George Kobiashvili wrote:
> Signed-off-by: George Kobiashvili 
> ---
>  drivers/staging/comedi/comedilib.h | 32 
>  1 file changed, 16 insertions(+), 16 deletions(-)

Doesn't apply to my tree :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 37/83] ste_dma40: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/dma/ste_dma40.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 2971d47..e2e0225 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3404,7 +3404,7 @@ static void __init d40_hw_init(struct d40_base *base)
 static int __init d40_lcla_allocate(struct d40_base *base)
 {
struct d40_lcla_pool *pool = >lcla_pool;
-   unsigned long *page_list;
+   void **page_list;
int i, j;
int ret = 0;
 
@@ -3413,7 +3413,7 @@ static int __init d40_lcla_allocate(struct d40_base *base)
 * To full fill this hardware requirement without wasting 256 kb
 * we allocate pages until we get an aligned one.
 */
-   page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS,
+   page_list = kmalloc(sizeof(void *) * MAX_LCLA_ALLOC_ATTEMPTS,
GFP_KERNEL);
 
if (!page_list) {
@@ -3425,7 +3425,7 @@ static int __init d40_lcla_allocate(struct d40_base *base)
base->lcla_pool.pages = SZ_1K * base->num_phy_chans / PAGE_SIZE;
 
for (i = 0; i < MAX_LCLA_ALLOC_ATTEMPTS; i++) {
-   page_list[i] = __get_free_pages(GFP_KERNEL,
+   page_list[i] = (void *)__get_free_pages(GFP_KERNEL,
base->lcla_pool.pages);
if (!page_list[i]) {
 
@@ -3434,20 +3434,20 @@ static int __init d40_lcla_allocate(struct d40_base 
*base)
ret = -ENOMEM;
 
for (j = 0; j < i; j++)
-   free_pages((void *)page_list[j], 
base->lcla_pool.pages);
+   free_pages(page_list[j], base->lcla_pool.pages);
goto failure;
}
 
-   if ((virt_to_phys((void *)page_list[i]) &
+   if ((virt_to_phys(page_list[i]) &
 (LCLA_ALIGNMENT - 1)) == 0)
break;
}
 
for (j = 0; j < i; j++)
-   free_pages((void *)page_list[j], base->lcla_pool.pages);
+   free_pages(page_list[j], base->lcla_pool.pages);
 
if (i < MAX_LCLA_ALLOC_ATTEMPTS) {
-   base->lcla_pool.base = (void *)page_list[i];
+   base->lcla_pool.base = page_list[i];
} else {
/*
 * After many attempts and no succees with finding the correct
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 39/83] gnttab_end_foreign_access(): switch the last argument to void *

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/block/xen-blkfront.c  | 12 ++--
 drivers/char/tpm/xen-tpmfront.c   |  2 +-
 drivers/input/misc/xen-kbdfront.c |  4 ++--
 drivers/net/xen-netfront.c|  6 +++---
 drivers/pci/xen-pcifront.c|  2 +-
 drivers/scsi/xen-scsifront.c  |  8 +++-
 drivers/xen/grant-table.c |  6 +++---
 include/xen/grant_table.h |  3 +--
 8 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 19b8697..c5873c2 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1094,7 +1094,7 @@ static void blkif_free(struct blkfront_info *info, int 
suspend)
list_del(_gnt->node);
if (persistent_gnt->gref != GRANT_INVALID_REF) {
gnttab_end_foreign_access(persistent_gnt->gref,
- 0, 0UL);
+ 0, NULL);
info->persistent_gnts_c--;
}
if (info->feature_persistent)
@@ -1131,7 +1131,7 @@ static void blkif_free(struct blkfront_info *info, int 
suspend)
   info->shadow[i].req.u.rw.nr_segments;
for (j = 0; j < segs; j++) {
persistent_gnt = info->shadow[i].grants_used[j];
-   gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
+   gnttab_end_foreign_access(persistent_gnt->gref, 0, 
NULL);
if (info->feature_persistent)
__free_page(persistent_gnt->page);
kfree(persistent_gnt);
@@ -1146,7 +1146,7 @@ static void blkif_free(struct blkfront_info *info, int 
suspend)
 
for (j = 0; j < INDIRECT_GREFS(segs); j++) {
persistent_gnt = info->shadow[i].indirect_grants[j];
-   gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
+   gnttab_end_foreign_access(persistent_gnt->gref, 0, 
NULL);
__free_page(persistent_gnt->page);
kfree(persistent_gnt);
}
@@ -1170,7 +1170,7 @@ free_shadow:
/* Free resources associated with old device channel. */
for (i = 0; i < info->nr_ring_pages; i++) {
if (info->ring_ref[i] != GRANT_INVALID_REF) {
-   gnttab_end_foreign_access(info->ring_ref[i], 0, 0);
+   gnttab_end_foreign_access(info->ring_ref[i], 0, NULL);
info->ring_ref[i] = GRANT_INVALID_REF;
}
}
@@ -1261,7 +1261,7 @@ static void blkif_completion(struct blk_shadow *s, struct 
blkfront_info *info,
 * so it will not be picked again unless we run out of
 * persistent grants.
 */
-   gnttab_end_foreign_access(s->grants_used[i]->gref, 0, 
0UL);
+   gnttab_end_foreign_access(s->grants_used[i]->gref, 0, 
NULL);
s->grants_used[i]->gref = GRANT_INVALID_REF;
list_add_tail(>grants_used[i]->node, >grants);
}
@@ -1277,7 +1277,7 @@ static void blkif_completion(struct blk_shadow *s, struct 
blkfront_info *info,
} else {
struct page *indirect_page;
 
-   
gnttab_end_foreign_access(s->indirect_grants[i]->gref, 0, 0UL);
+   
gnttab_end_foreign_access(s->indirect_grants[i]->gref, 0, NULL);
/*
 * Add the used indirect page back to the list 
of
 * available pages for indirect grefs.
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 4ac4830..2ccd0c9 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -273,7 +273,7 @@ static void ring_free(struct tpm_private *priv)
 
if (priv->ring_ref)
gnttab_end_foreign_access(priv->ring_ref, 0,
-   (unsigned long)priv->shr);
+   priv->shr);
else
free_page(priv->shr);
 
diff --git a/drivers/input/misc/xen-kbdfront.c 
b/drivers/input/misc/xen-kbdfront.c
index d70a619..93f3a5c 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -291,7 +291,7 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
  error_evtchan:
xenbus_free_evtchn(dev, evtchn);
  error_grant:
-   gnttab_end_foreign_access(info->gref, 0, 0UL);
+   gnttab_end_foreign_access(info->gref, 0, NULL);
info->gref = -1;
return ret;
 }
@@ -302,7 +302,7 @@ static void 

[POC][PATCH 36/83] pcibios: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/x86/pci/pcbios.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 7958c26..674ecff 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -381,14 +381,14 @@ struct irq_routing_table * 
pcibios_get_irq_routing_table(void)
struct irq_routing_options opt;
struct irq_routing_table *rt = NULL;
int ret, map;
-   unsigned long page;
+   void *page;
 
if (!pci_bios_present)
return NULL;
-   page = __get_free_page(GFP_KERNEL);
+   page = (void *)__get_free_page(GFP_KERNEL);
if (!page)
return NULL;
-   opt.table = (struct irq_info *) page;
+   opt.table = page;
opt.size = PAGE_SIZE;
opt.segment = __KERNEL_DS;
 
@@ -419,11 +419,11 @@ struct irq_routing_table * 
pcibios_get_irq_routing_table(void)
memset(rt, 0, sizeof(struct irq_routing_table));
rt->size = opt.size + sizeof(struct irq_routing_table);
rt->exclusive_irqs = map;
-   memcpy(rt->slots, (void *) page, opt.size);
+   memcpy(rt->slots, page, opt.size);
printk(KERN_INFO "PCI: Using BIOS Interrupt Routing 
Table\n");
}
}
-   free_page((void *)page);
+   free_page(page);
return rt;
 }
 EXPORT_SYMBOL(pcibios_get_irq_routing_table);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 45/83] arm: switch kvm_arm_hyp_stack_page to void *

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/arm/include/asm/kvm_host.h   |  4 ++--
 arch/arm/kvm/arm.c| 13 +
 arch/arm64/include/asm/kvm_host.h |  2 +-
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 6692982..20c51e8 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -190,7 +190,7 @@ int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
 
 static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
   phys_addr_t pgd_ptr,
-  unsigned long hyp_stack_ptr,
+  void *hyp_stack_ptr,
   unsigned long vector_ptr)
 {
/*
@@ -211,7 +211,7 @@ static inline void __cpu_init_hyp_mode(phys_addr_t 
boot_pgd_ptr,
 
kvm_call_hyp(NULL, 0, boot_pgd_ptr);
 
-   kvm_call_hyp((void*)hyp_stack_ptr, vector_ptr, pgd_ptr);
+   kvm_call_hyp(hyp_stack_ptr, vector_ptr, pgd_ptr);
 }
 
 static inline int kvm_arch_dev_ioctl_check_extension(long ext)
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 08fe183..385bdce 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -49,7 +49,7 @@
 __asm__(".arch_extension   virt");
 #endif
 
-static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
+static DEFINE_PER_CPU(void *, kvm_arm_hyp_stack_page);
 static kvm_cpu_context_t __percpu *kvm_host_cpu_state;
 static unsigned long hyp_default_vectors;
 
@@ -958,8 +958,7 @@ static void cpu_init_hyp_mode(void *dummy)
 {
phys_addr_t boot_pgd_ptr;
phys_addr_t pgd_ptr;
-   unsigned long hyp_stack_ptr;
-   unsigned long stack_page;
+   void *hyp_stack_ptr, *stack_page;
unsigned long vector_ptr;
 
/* Switch from the HYP stub to our own HYP init vector */
@@ -1047,9 +1046,7 @@ static int init_hyp_mode(void)
 * Allocate stack pages for Hypervisor-mode
 */
for_each_possible_cpu(cpu) {
-   unsigned long stack_page;
-
-   stack_page = __get_free_page(GFP_KERNEL);
+   void *stack_page = (void *)__get_free_page(GFP_KERNEL);
if (!stack_page) {
err = -ENOMEM;
goto out_free_stack_pages;
@@ -1071,7 +1068,7 @@ static int init_hyp_mode(void)
 * Map the Hyp stack pages
 */
for_each_possible_cpu(cpu) {
-   char *stack_page = (char *)per_cpu(kvm_arm_hyp_stack_page, cpu);
+   char *stack_page = per_cpu(kvm_arm_hyp_stack_page, cpu);
err = create_hyp_mappings(stack_page, stack_page + PAGE_SIZE);
 
if (err) {
@@ -1136,7 +1133,7 @@ out_free_mappings:
free_hyp_pgds();
 out_free_stack_pages:
for_each_possible_cpu(cpu)
-   free_page((void *)per_cpu(kvm_arm_hyp_stack_page, cpu));
+   free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
 out_err:
kvm_err("error initializing Hyp mode: %d\n", err);
return err;
diff --git a/arch/arm64/include/asm/kvm_host.h 
b/arch/arm64/include/asm/kvm_host.h
index a35ce72..e3adc1d 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -236,7 +236,7 @@ struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, 
unsigned long mpidr);
 
 static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
   phys_addr_t pgd_ptr,
-  unsigned long hyp_stack_ptr,
+  void *hyp_stack_ptr,
   unsigned long vector_ptr)
 {
/*
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 38/83] usb_mon: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/usb/mon/mon_bin.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index cdc68e5..26d497b 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1305,17 +1305,16 @@ static int mon_bin_wait_event(struct file *file, struct 
mon_reader_bin *rp)
 static int mon_alloc_buff(struct mon_pgmap *map, int npages)
 {
int n;
-   unsigned long vaddr;
 
for (n = 0; n < npages; n++) {
-   vaddr = (unsigned long)get_zeroed_page(GFP_KERNEL);
-   if (vaddr == 0) {
+   void *vaddr = get_zeroed_page(GFP_KERNEL);
+   if (!vaddr) {
while (n-- != 0)
free_page(map[n].ptr);
return -ENOMEM;
}
-   map[n].ptr = (unsigned char *) vaddr;
-   map[n].pg = virt_to_page((void *) vaddr);
+   map[n].ptr = vaddr;
+   map[n].pg = virt_to_page(vaddr);
}
return 0;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 40/83] nios2: dma_free_coherent(): get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/nios2/mm/dma-mapping.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index fa242ab..0195f8f 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -50,9 +50,7 @@ EXPORT_SYMBOL(dma_alloc_coherent);
 void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_handle)
 {
-   unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
-
-   free_pages((void *)addr, get_order(size));
+   free_pages(CAC_ADDR(vaddr), get_order(size));
 }
 EXPORT_SYMBOL(dma_free_coherent);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 42/83] simserial: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/ia64/hp/sim/simserial.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 6e81449..7c3871e 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -364,19 +364,20 @@ static int activate(struct tty_port *port, struct 
tty_struct *tty)
 {
struct serial_state *state = container_of(port, struct serial_state,
port);
-   unsigned long flags, page;
+   unsigned long flags;
+   unsigned char *page;
int retval = 0;
 
-   page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;
 
local_irq_save(flags);
 
if (state->xmit.buf)
-   free_page((void *)page);
+   free_page(page);
else
-   state->xmit.buf = (unsigned char *) page;
+   state->xmit.buf = page;
 
if (state->irq) {
retval = request_irq(state->irq, rs_interrupt_single, 0,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 44/83] cris free_init_page(): switch to __free_page()

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/cris/mm/init.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index dd87022..71a012c 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -40,9 +40,10 @@ void free_init_pages(const char *what, unsigned long begin, 
unsigned long end)
unsigned long addr;
 
for (addr = begin; addr < end; addr += PAGE_SIZE) {
-   ClearPageReserved(virt_to_page(addr));
-   init_page_count(virt_to_page(addr));
-   free_page((void *)addr);
+   struct page *page = virt_to_page(addr);
+   ClearPageReserved(page);
+   init_page_count(page);
+   __free_page(page);
totalram_pages++;
}
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 41/83] hsi: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/hsi/clients/cmt_speech.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/hsi/clients/cmt_speech.c b/drivers/hsi/clients/cmt_speech.c
index 96d98fc..86ef330 100644
--- a/drivers/hsi/clients/cmt_speech.c
+++ b/drivers/hsi/clients/cmt_speech.c
@@ -54,7 +54,7 @@ struct cs_char {
struct list_headdataind_queue;
int dataind_pending;
/* mmap things */
-   unsigned long   mmap_base;
+   void*mmap_base;
unsigned long   mmap_size;
spinlock_t  lock;
struct fasync_struct*async_queue;
@@ -101,7 +101,7 @@ struct cs_hsi_iface {
/* state exposed to application */
struct cs_mmap_config_block *mmap_cfg;
 
-   unsigned long   mmap_base;
+   void*mmap_base;
unsigned long   mmap_size;
 
unsigned intrx_slot;
@@ -677,7 +677,7 @@ static void cs_hsi_read_on_data(struct cs_hsi_iface *hi)
spin_unlock(>lock);
 
rxmsg = hi->data_rx_msg;
-   sg_init_one(rxmsg->sgt.sgl, (void *)hi->mmap_base, 0);
+   sg_init_one(rxmsg->sgt.sgl, hi->mmap_base, 0);
rxmsg->sgt.nents = 0;
rxmsg->complete = cs_hsi_peek_on_data_complete;
 
@@ -996,7 +996,7 @@ error:
 }
 
 static int cs_hsi_start(struct cs_hsi_iface **hi, struct hsi_client *cl,
-   unsigned long mmap_base, unsigned long mmap_size)
+   void *mmap_base, unsigned long mmap_size)
 {
int err = 0;
struct cs_hsi_iface *hsi_if = kzalloc(sizeof(*hsi_if), GFP_KERNEL);
@@ -1288,7 +1288,7 @@ static int cs_char_mmap(struct file *file, struct 
vm_area_struct *vma)
 static int cs_char_open(struct inode *unused, struct file *file)
 {
int ret = 0;
-   unsigned long p;
+   void *p;
 
spin_lock_bh(_char_data.lock);
if (cs_char_data.opened) {
@@ -1300,7 +1300,7 @@ static int cs_char_open(struct inode *unused, struct file 
*file)
cs_char_data.dataind_pending = 0;
spin_unlock_bh(_char_data.lock);
 
-   p = (unsigned long)get_zeroed_page(GFP_KERNEL);
+   p = get_zeroed_page(GFP_KERNEL);
if (!p) {
ret = -ENOMEM;
goto out2;
@@ -1321,7 +1321,7 @@ static int cs_char_open(struct inode *unused, struct file 
*file)
return 0;
 
 out3:
-   free_page((void *)p);
+   free_page(p);
 out2:
spin_lock_bh(_char_data.lock);
cs_char_data.opened = 0;
@@ -1352,7 +1352,7 @@ static int cs_char_release(struct inode *unused, struct 
file *file)
cs_hsi_stop(csdata->hi);
spin_lock_bh(>lock);
csdata->hi = NULL;
-   free_page((void *)csdata->mmap_base);
+   free_page(csdata->mmap_base);
cs_free_char_queue(>chardev_queue);
cs_free_char_queue(>dataind_queue);
csdata->opened = 0;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 43/83] arm64 vdso: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

... with two added to cope with flush_icache_range() calling
conventions

Signed-off-by: Al Viro 
---
 arch/arm64/kernel/vdso.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 07e4d14..f49e158 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -62,22 +62,21 @@ static int alloc_vectors_page(void)
 
int kuser_sz = __kuser_helper_end - __kuser_helper_start;
int sigret_sz = __aarch32_sigret_code_end - __aarch32_sigret_code_start;
-   unsigned long vpage;
-
-   vpage = (unsigned long)get_zeroed_page(GFP_ATOMIC);
+   void *vpage = get_zeroed_page(GFP_ATOMIC);
 
if (!vpage)
return -ENOMEM;
 
/* kuser helpers */
-   memcpy((void *)vpage + 0x1000 - kuser_sz, __kuser_helper_start,
+   memcpy(vpage + 0x1000 - kuser_sz, __kuser_helper_start,
kuser_sz);
 
/* sigreturn code */
-   memcpy((void *)vpage + AARCH32_KERN_SIGRET_CODE_OFFSET,
+   memcpy(vpage + AARCH32_KERN_SIGRET_CODE_OFFSET,
__aarch32_sigret_code_start, sigret_sz);
 
-   flush_icache_range(vpage, vpage + PAGE_SIZE);
+   flush_icache_range((unsigned long)vpage,
+  (unsigned long)vpage + PAGE_SIZE);
vectors_page[0] = virt_to_page(vpage);
 
return 0;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 47/83] ia64: uncached_add_chunk(): switch to __free_pages()

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/ia64/kernel/uncached.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index 9b90526..35494cc 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -166,7 +166,7 @@ failed:
for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
ClearPageUncached([i]);
 
-   free_pages((void *)c_addr, IA64_GRANULE_SHIFT-PAGE_SHIFT);
+   __free_pages(page, IA64_GRANULE_SHIFT-PAGE_SHIFT);
mutex_unlock(_pool->add_chunk_mutex);
return -1;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 48/83] jfs_readdir(): make dirent_buf a pointer

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 fs/jfs/jfs_dtree.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index e585852..56d18de 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3023,7 +3023,7 @@ int jfs_readdir(struct file *file, struct dir_context 
*ctx)
struct ldtentry *d;
struct dtslot *t;
int d_namleft, len, outlen;
-   unsigned long dirent_buf;
+   void *dirent_buf;
char *name_ptr;
u32 dir_index;
int do_index = 0;
@@ -3180,8 +3180,8 @@ int jfs_readdir(struct file *file, struct dir_context 
*ctx)
}
}
 
-   dirent_buf = __get_free_page(GFP_KERNEL);
-   if (dirent_buf == 0) {
+   dirent_buf = (void *)__get_free_page(GFP_KERNEL);
+   if (!dirent_buf) {
DT_PUTPAGE(mp);
jfs_warn("jfs_readdir: __get_free_page failed!");
ctx->pos = DIREND;
@@ -3198,7 +3198,7 @@ int jfs_readdir(struct file *file, struct dir_context 
*ctx)
for (i = index; i < p->header.nextindex; i++) {
d = (struct ldtentry *) & p->slot[stbl[i]];
 
-   if (((long) jfs_dirent + d->namlen + 1) >
+   if (((void *) jfs_dirent + d->namlen + 1) >
(dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */
index = i;
@@ -3324,13 +3324,13 @@ skip_one:
 
DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
if (rc) {
-   free_page((void *)dirent_buf);
+   free_page(dirent_buf);
return rc;
}
}
 
   out:
-   free_page((void *)dirent_buf);
+   free_page(dirent_buf);
 
return rc;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 49/83] get rid of casts in alloc_exact stuff

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 mm/page_alloc.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index aa37489..a1aa8eb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3449,20 +3449,20 @@ void free_kmem_pages(unsigned long addr, unsigned int 
order)
}
 }
 
-static void *make_alloc_exact(unsigned long addr, unsigned int order,
+static void *make_alloc_exact(void *addr, unsigned int order,
size_t size)
 {
if (addr) {
-   unsigned long alloc_end = addr + (PAGE_SIZE << order);
-   unsigned long used = addr + PAGE_ALIGN(size);
+   void *alloc_end = addr + (PAGE_SIZE << order);
+   void *used = addr + PAGE_ALIGN(size);
 
-   split_page(virt_to_page((void *)addr), order);
+   split_page(virt_to_page(addr), order);
while (used < alloc_end) {
-   free_page((void *)used);
+   free_page(used);
used += PAGE_SIZE;
}
}
-   return (void *)addr;
+   return addr;
 }
 
 /**
@@ -3481,9 +3481,7 @@ static void *make_alloc_exact(unsigned long addr, 
unsigned int order,
 void *alloc_pages_exact(size_t size, gfp_t gfp_mask)
 {
unsigned int order = get_order(size);
-   unsigned long addr;
-
-   addr = __get_free_pages(gfp_mask, order);
+   void *addr = (void *)__get_free_pages(gfp_mask, order);
return make_alloc_exact(addr, order, size);
 }
 EXPORT_SYMBOL(alloc_pages_exact);
@@ -3504,7 +3502,7 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t 
size, gfp_t gfp_mask)
struct page *p = alloc_pages_node(nid, gfp_mask, order);
if (!p)
return NULL;
-   return make_alloc_exact((unsigned long)page_address(p), order, size);
+   return make_alloc_exact(page_address(p), order, size);
 }
 
 /**
@@ -3516,12 +3514,11 @@ void * __meminit alloc_pages_exact_nid(int nid, size_t 
size, gfp_t gfp_mask)
  */
 void free_pages_exact(void *virt, size_t size)
 {
-   unsigned long addr = (unsigned long)virt;
-   unsigned long end = addr + PAGE_ALIGN(size);
+   void *end = virt + PAGE_ALIGN(size);
 
-   while (addr < end) {
-   free_page((void *)addr);
-   addr += PAGE_SIZE;
+   while (virt < end) {
+   free_page(virt);
+   virt += PAGE_SIZE;
}
 }
 EXPORT_SYMBOL(free_pages_exact);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 46/83] frv consistent_alloc(): switch page to void *

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 arch/frv/mm/dma-alloc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/frv/mm/dma-alloc.c b/arch/frv/mm/dma-alloc.c
index c4c19ff..62268e1 100644
--- a/arch/frv/mm/dma-alloc.c
+++ b/arch/frv/mm/dma-alloc.c
@@ -81,7 +81,8 @@ static int map_page(unsigned long va, unsigned long pa, 
pgprot_t prot)
 void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 {
struct vm_struct *area;
-   unsigned long page, va, pa;
+   unsigned long va, pa;
+   void *page;
void *ret;
int order, err, i;
 
@@ -92,7 +93,7 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t 
*dma_handle)
size = PAGE_ALIGN(size);
order = get_order(size);
 
-   page = __get_free_pages(gfp, order);
+   page = (void *)__get_free_pages(gfp, order);
if (!page) {
BUG();
return NULL;
@@ -101,14 +102,14 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t 
*dma_handle)
/* allocate some common virtual space to map the new pages */
area = get_vm_area(size, VM_ALLOC);
if (area == 0) {
-   free_pages((void *)page, order);
+   free_pages(page, order);
return NULL;
}
va = VMALLOC_VMADDR(area->addr);
ret = (void *) va;
 
/* this gives us the real physical address of the first page */
-   *dma_handle = pa = virt_to_bus((void *) page);
+   *dma_handle = pa = virt_to_bus(page);
 
/* set refcount=1 on all pages in an order>0 allocation so that vfree() 
will actually free
 * all pages that were allocated.
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 59/83] add pointer-returning variants of __get_free_pages/__get_free_page

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/block/xen-blkback/blkback.c | 4 ++--
 drivers/xen/xen-scsiback.c  | 6 +++---
 include/linux/gfp.h | 9 +++--
 mm/page_alloc.c | 8 
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index f909994..aa1c52a 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -113,7 +113,7 @@ module_param(log_stats, int, 0644);
 /* Number of free pages to remove on each call to gnttab_free_pages */
 #define NUM_BATCH_FREE_PAGES 10
 
-static inline int get_free_page(struct xen_blkif *blkif, struct page **page)
+static inline int xen_get_free_page(struct xen_blkif *blkif, struct page 
**page)
 {
unsigned long flags;
 
@@ -819,7 +819,7 @@ again:
pages[i]->page = persistent_gnt->page;
pages[i]->persistent_gnt = persistent_gnt;
} else {
-   if (get_free_page(blkif, [i]->page))
+   if (xen_get_free_page(blkif, [i]->page))
goto out_of_memory;
addr = vaddr(pages[i]->page);
pages_to_gnt[segs_to_map] = pages[i]->page;
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 43bcae8..ebd2321 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -229,7 +229,7 @@ static void put_free_pages(struct page **page, int num)
spin_unlock_irqrestore(_pages_lock, flags);
 }
 
-static int get_free_page(struct page **page)
+static int xen_get_free_page(struct page **page)
 {
unsigned long flags;
 
@@ -439,7 +439,7 @@ static int scsiback_gnttab_data_map_list(struct 
vscsibk_pend *pending_req,
struct vscsibk_info *info = pending_req->info;
 
for (i = 0; i < cnt; i++) {
-   if (get_free_page(pg + mapcount)) {
+   if (xen_get_free_page(pg + mapcount)) {
put_free_pages(pg, mapcount);
pr_err("no grant page\n");
return -ENOMEM;
@@ -1902,7 +1902,7 @@ static void __exit scsiback_exit(void)
struct page *page;
 
while (free_pages_num) {
-   if (get_free_page())
+   if (xen_get_free_page())
BUG();
gnttab_free_pages(1, );
}
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index fc4529d..bb1626a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -473,18 +473,23 @@ extern struct page *alloc_kmem_pages(gfp_t gfp_mask, 
unsigned int order);
 extern struct page *alloc_kmem_pages_node(int nid, gfp_t gfp_mask,
  unsigned int order);
 
-extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
+extern void *get_free_pages(gfp_t gfp_mask, unsigned int order);
+#define __get_free_pages(gfp_mask, order) \
+   ((unsigned long)get_free_pages(gfp_mask, order))
 extern void *get_zeroed_page(gfp_t gfp_mask);
 
 void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
 void free_pages_exact(void *virt, size_t size);
 void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
 
+#define get_free_page(gfp_mask) \
+   get_free_pages((gfp_mask), 0)
+
 #define __get_free_page(gfp_mask) \
__get_free_pages((gfp_mask), 0)
 
 #define get_dma_pages(gfp_mask, order) \
-   ((void *)__get_free_pages((gfp_mask) | GFP_DMA, (order)))
+   get_free_pages((gfp_mask) | GFP_DMA, (order))
 
 extern void __free_pages(struct page *page, unsigned int order);
 extern void free_pages(const void *addr, unsigned int order);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a1aa8eb..9ab053f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3257,7 +3257,7 @@ EXPORT_SYMBOL(__alloc_pages_nodemask);
 /*
  * Common helper functions.
  */
-unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)
+void *get_free_pages(gfp_t gfp_mask, unsigned int order)
 {
struct page *page;
 
@@ -3269,10 +3269,10 @@ unsigned long __get_free_pages(gfp_t gfp_mask, unsigned 
int order)
 
page = alloc_pages(gfp_mask, order);
if (!page)
-   return 0;
-   return (unsigned long) page_address(page);
+   return NULL;
+   return page_address(page);
 }
-EXPORT_SYMBOL(__get_free_pages);
+EXPORT_SYMBOL(get_free_pages);
 
 void *get_zeroed_page(gfp_t gfp_mask)
 {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[POC][PATCH 58/83] iwlwifi: get rid of pointless casts

2015-12-21 Thread Al Viro
From: Al Viro 

Signed-off-by: Al Viro 
---
 drivers/net/wireless/iwlwifi/iwl-trans.h | 4 ++--
 drivers/net/wireless/iwlwifi/pcie/tx.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 8ccbda2..94d3c5b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -331,7 +331,7 @@ enum iwl_hcmd_dataflag {
 struct iwl_host_cmd {
const void *data[IWL_MAX_CMD_TBS_PER_TFD];
struct iwl_rx_packet *resp_pkt;
-   unsigned long _rx_page_addr;
+   void *_rx_page_addr;
u32 _rx_page_order;
 
u32 flags;
@@ -342,7 +342,7 @@ struct iwl_host_cmd {
 
 static inline void iwl_free_resp(struct iwl_host_cmd *cmd)
 {
-   free_pages((void *)cmd->_rx_page_addr, cmd->_rx_page_order);
+   free_pages(cmd->_rx_page_addr, cmd->_rx_page_order);
 }
 
 struct iwl_rx_cmd_buffer {
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c 
b/drivers/net/wireless/iwlwifi/pcie/tx.c
index a8c8a4a..53f1380 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1634,7 +1634,7 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
struct page *p = rxb_steal_page(rxb);
 
meta->source->resp_pkt = pkt;
-   meta->source->_rx_page_addr = (unsigned long)page_address(p);
+   meta->source->_rx_page_addr = page_address(p);
meta->source->_rx_page_order = trans_pcie->rx_page_order;
}
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    1   2   3   4   5   6   7   8   9   10   >