From 1e483969930a82e16767884449f3a121a817ef00 Mon Sep 17 00:00:00 2001 From: David Shaohua Li Date: Thu, 1 Dec 2005 17:00:00 -0500 Subject: [ACPI] correct earlier SMP deep C-states on HT patch http://bugzilla.kernel.org/show_bug.cgi?id=5165 Change polarity of test for PLVL2_UP flag. Skip promotion/demotion code when not needed. Signed-off-by: Shaohua Li Signed-off-by: Venkatesh Pallipadi Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 83fd1b6c10c..800f99c4c0e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -278,8 +278,6 @@ static void acpi_processor_idle(void) } } - cx->usage++; - #ifdef CONFIG_HOTPLUG_CPU /* * Check for P_LVL2_UP flag before entering C2 and above on @@ -287,9 +285,12 @@ static void acpi_processor_idle(void) * detection phase, to work cleanly with logical CPU hotplug. */ if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && acpi_fadt.plvl2_up) - cx->type = ACPI_STATE_C1; + !pr->flags.has_cst && !acpi_fadt.plvl2_up) + cx = &pr->power.states[ACPI_STATE_C1]; #endif + + cx->usage++; + /* * Sleep: * ------ @@ -378,6 +379,15 @@ static void acpi_processor_idle(void) next_state = pr->power.state; +#ifdef CONFIG_HOTPLUG_CPU + /* Don't do promotion/demotion */ + if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) && + !pr->flags.has_cst && !acpi_fadt.plvl2_up) { + next_state = cx; + goto end; + } +#endif + /* * Promotion? * ---------- @@ -549,7 +559,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) * Check for P_LVL2_UP flag before entering C2 and above on * an SMP system. */ - if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up) + if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) return_VALUE(-ENODEV); #endif -- cgit v1.2.3 From bb58596f6802a4959c2cea02acd272245e671c1d Mon Sep 17 00:00:00 2001 From: Dave C Boutcher Date: Tue, 15 Nov 2005 09:53:00 -0600 Subject: [SCSI] ibmvscsi kexec fix This makes ibmvscsi work correctly with the recent set of kexec patches that went in. This is based on work by Michael Ellerman, who chased this initially. He validated that it works during kexec. Handle kexec correctly in ibmvscsi. During kexec the adapter will not get cleaned up correctly, so we may need to reset it to make it sane again. Signed-off-by: Dave Boutcher Signed-off-by: James Bottomley --- drivers/scsi/ibmvscsi/ibmvscsi.h | 2 +- drivers/scsi/ibmvscsi/iseries_vscsi.c | 3 ++- drivers/scsi/ibmvscsi/rpa_vscsi.c | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h index 8bec0438dc8..5b0edd1f192 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.h +++ b/drivers/scsi/ibmvscsi/ibmvscsi.h @@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, void ibmvscsi_release_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata, int max_requests); -void ibmvscsi_reset_crq_queue(struct crq_queue *queue, +int ibmvscsi_reset_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata); void ibmvscsi_handle_crq(struct viosrp_crq *crq, diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c index 1045872b017..ce15d9e3962 100644 --- a/drivers/scsi/ibmvscsi/iseries_vscsi.c +++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c @@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue, * * no-op for iSeries */ -void ibmvscsi_reset_crq_queue(struct crq_queue *queue, +int ibmvscsi_reset_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata) { + return 0; } /** diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index 8bf5652f106..75db2f5c545 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c @@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address, queue->msg_token, PAGE_SIZE); + if (rc == H_Resource) + /* maybe kexecing and resource is busy. try a reset */ + rc = ibmvscsi_reset_crq_queue(queue, + hostdata); + if (rc == 2) { /* Adapter is good, but other end is not ready */ printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); @@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, * @hostdata: ibmvscsi_host_data of host * */ -void ibmvscsi_reset_crq_queue(struct crq_queue *queue, +int ibmvscsi_reset_crq_queue(struct crq_queue *queue, struct ibmvscsi_host_data *hostdata) { int rc; @@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue, printk(KERN_WARNING "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); } + return rc; } -- cgit v1.2.3 From 23443b1d6130eff8e1335e4f84eaf0577a331dcf Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Tue, 6 Dec 2005 10:57:06 -0800 Subject: [SCSI] qla2xxx: Correct mis-handling of AENs. A regression in a recent change 33135aa2a568ec1a30e734f18e5315e10516e4f3 caused the driver to mistakenly drop handling of AENs. Due to the incorrect handling, ports would not reappear after RSCNs and LIPs. Drops unused/incorrect compound #define from qla_def.h. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_def.h | 10 +--------- drivers/scsi/qla2xxx/qla_init.c | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 7096945ea23..7b3efd53129 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2476,17 +2476,9 @@ typedef struct scsi_qla_host { */ #define LOOP_TRANSITION(ha) \ (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ - test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) - -#define LOOP_NOT_READY(ha) \ - ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ - test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \ - test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ - test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \ + test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ atomic_read(&ha->loop_state) == LOOP_DOWN) -#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha)) - #define TGT_Q(ha, t) (ha->otgt[t]) #define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 2d720121a0d..c46d2469b85 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1259,7 +1259,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha) rval = qla2x00_get_adapter_id(ha, &loop_id, &al_pa, &area, &domain, &topo); if (rval != QLA_SUCCESS) { - if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || + if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) || (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { DEBUG2(printk("%s(%ld) Loop is in a transition state\n", __func__, ha->host_no)); @@ -1796,7 +1796,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha) } if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { - if (LOOP_NOT_READY(ha)) { + if (LOOP_TRANSITION(ha)) { rval = QLA_FUNCTION_FAILED; } else { rval = qla2x00_configure_fabric(ha); @@ -2369,7 +2369,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) if (qla2x00_is_reserved_id(ha, loop_id)) continue; - if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) + if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha)) break; if (swl != NULL) { -- cgit v1.2.3 From 0da69df1e54146eece38e0a144051f6dd3526821 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Tue, 6 Dec 2005 10:58:06 -0800 Subject: [SCSI] qla2xxx: Correct short-WRITE status handling. Properly check FC_RESID for any non-transfered bytes regardless of firmware completion status. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_isr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 09afc0f06bd..5181d966fec 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) resid = resid_len; cp->resid = resid; CMD_RESID_LEN(cp) = resid; + + if (!lscsi_status && + ((unsigned)(cp->request_bufflen - resid) < + cp->underflow)) { + qla_printk(KERN_INFO, ha, + "scsi(%ld:%d:%d:%d): Mid-layer underflow " + "detected (%x of %x bytes)...returning " + "error status.\n", ha->host_no, + cp->device->channel, cp->device->id, + cp->device->lun, resid, + cp->request_bufflen); + + cp->result = DID_ERROR << 16; + break; + } } cp->result = DID_OK << 16 | lscsi_status; -- cgit v1.2.3 From f0353301e6752399ceb874ede7f44e3571c5e4f3 Mon Sep 17 00:00:00 2001 From: Mark Lord Date: Wed, 7 Dec 2005 17:46:57 -0500 Subject: [SCSI] Fix incorrect pointer in megaraid.c MODE_SENSE emulation The SCSI megaraid drive goes to great effort to kmap the scatterlist buffer (if used), but then uses the wrong pointer when copying to it afterward. Signed-off-by: Mark Lord Acked by: Ju, Seokmann Signed-off-by: James Bottomley --- drivers/scsi/megaraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index f9792528e33..578143e93a6 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -664,7 +664,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) sg->offset; } else buf = cmd->request_buffer; - memset(cmd->request_buffer, 0, cmd->cmnd[4]); + memset(buf, 0, cmd->cmnd[4]); if (cmd->use_sg) { struct scatterlist *sg; -- cgit v1.2.3 From 85631672e6a8032267058b4ccbe53f1924a5d0be Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Wed, 7 Dec 2005 21:46:27 -0600 Subject: [SCSI] fix OOPS due to clearing eh_action prior to aborting eh command The eh_action semaphore in scsi_eh_send_command is cleared after a command timeout. The command is subsequently aborted and the abort will try to call scsi_done() on it. Unfortunately, the scsi_eh_done() routine unconditinally completes the semaphore (which is now null). Fix this race by makiong the scsi_eh_done() routine check that the semaphore is non null before completing it (mirroring the ordinary command done/timeout logic). Signed-off-by: James Bottomley --- drivers/scsi/scsi_error.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 18c5d252301..c0ae9e965f6 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) **/ static void scsi_eh_done(struct scsi_cmnd *scmd) { + struct completion *eh_action; + SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", __FUNCTION__, scmd, scmd->result)); - complete(scmd->device->host->eh_action); + + eh_action = scmd->device->host->eh_action; + if (eh_action) + complete(eh_action); } /** -- cgit v1.2.3 From a8c730e85e80734412f4f73ab28496a0e8b04a7b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 9 Dec 2005 14:42:16 +0100 Subject: [SCSI] fix panic when ejecting ieee1394 ipod The scsi_library routines don't correctly set DMA_NONE when req->data_len is zero (instead they check the command type first, so if it's write, we end up with req->data_len == 0 and direction as DMA_TO_DEVICE which confuses some drivers) Signed-off-by: James Bottomley --- drivers/scsi/scsi_lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 4afef5cdcb1..097888721ec 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1215,12 +1215,12 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) } else { memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); cmd->cmd_len = req->cmd_len; - if (rq_data_dir(req) == WRITE) + if (!req->data_len) + cmd->sc_data_direction = DMA_NONE; + else if (rq_data_dir(req) == WRITE) cmd->sc_data_direction = DMA_TO_DEVICE; - else if (req->data_len) - cmd->sc_data_direction = DMA_FROM_DEVICE; else - cmd->sc_data_direction = DMA_NONE; + cmd->sc_data_direction = DMA_FROM_DEVICE; cmd->transfersize = req->data_len; cmd->allowed = 3; -- cgit v1.2.3 From 1ee9530a71686436dbeb5f31dd5b925c39cf71d7 Mon Sep 17 00:00:00 2001 From: Lothar Wassmann Date: Mon, 12 Dec 2005 16:44:05 +0000 Subject: [ARM] 3201/1: PXA27x: Prevent hangup during resume due to inadvertedly enabling MBREQ (replaces: 3198/1) Patch from Lothar Wassmann The patch makes sure, that the ouptut functions of pins are restored before restoring the Alternat Function settings, preventing pins from being intermediately configured for undefined or unwanted alternate functions. Here is the original comment: I've got a PXA270 system that uses GPIO80 as nCS4. This system did hang on resume. Digging into the problem I found that the processor stalled immediately when restoring the GAFR2_U register which restored the alternate function for GPIO80. Since the GPDR registers were restored after the GAFR registers, the offending GPIO was configured as input at this point. Thus the alternate function that was in effect after restoring the GAFR was in fact the input function "MBREQ" instead of the output function "nCS4". The "PXA27x Processor Family Developer's Manual" (Footnote in Table 6-1 on page 6-3) states that: "The MBREQ alternate function must not be enabled until the PSSR[RDH] bit field is cleared. For more details, see Table 3-15, "PSSR Bit Definitions" on page 3-71." There is another note in the Developer's Manual (chapter 24.4.2 "GPIO operation as Alternate Function" on page 24-4) stating that: "Configuring a GPIO for an alternate function that is not defined for it causes unpredictable results." Since some GPIOs have no input function defined, and to prevent inadvertedly programming the MBREQ function on some pin, the GAFR registers should be restored after the GPDR registers have been restored. Additional provisions have to be made when the MBREQ function is actually required. The corresponding GAFR bits should not be restored with the regular GAFR restore, but must be set only after the PSSR bits have been cleared. Signed-off-by: Lothar Wassmann Signed-off-by: Russell King --- arch/arm/mach-pxa/pm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index f74b9af112d..852ea72d8c8 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c @@ -155,19 +155,20 @@ int pxa_pm_enter(suspend_state_t state) PSPR = 0; /* restore registers */ + RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2); + RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2); RESTORE(GAFR0_L); RESTORE(GAFR0_U); RESTORE(GAFR1_L); RESTORE(GAFR1_U); RESTORE(GAFR2_L); RESTORE(GAFR2_U); - RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2); - RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2); RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2); RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2); RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); #ifdef CONFIG_PXA27x RESTORE(MDREFR); - RESTORE(GAFR3_L); RESTORE(GAFR3_U); RESTORE_GPLEVEL(3); - RESTORE(GPDR3); RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3); + RESTORE_GPLEVEL(3); RESTORE(GPDR3); + RESTORE(GAFR3_L); RESTORE(GAFR3_U); + RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3); RESTORE(PWER); RESTORE(PCFR); RESTORE(PRER); RESTORE(PFER); RESTORE(PKWR); #endif -- cgit v1.2.3 From 1a68de5c08be8c77c4ad208306187bd95107c7cd Mon Sep 17 00:00:00 2001 From: Brian King Date: Mon, 12 Dec 2005 13:05:08 -0600 Subject: [SCSI] fix double free of scsi request queue Current scsi scanning code appears to have a use after free bug is a LLDD's slave_alloc fails. Remove the redundant scsi_free_queue. Signed-off-by: Brian King Signed-off-by: James Bottomley --- drivers/scsi/scsi_scan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 374853df9cc..be276ea8f03 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -279,7 +279,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, out_device_destroy: transport_destroy_device(&sdev->sdev_gendev); - scsi_free_queue(sdev->request_queue); put_device(&sdev->sdev_gendev); out: if (display_failure_msg) -- cgit v1.2.3 From 48622b7bde008387218a416586e9d072b385f1ae Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Thu, 1 Dec 2005 18:51:52 -0500 Subject: ieee1394: resume remote ports when starting a host (fixes device recognition) After initializing an IEEE 1394 host, broadcast a resume packet. This makes remote nodes visible which suspended their ports while the host was down. Such nodes had to be unplugged and replugged in order to be recognized. Motorola DCT6200 cable reciever was affected, probably other devices too. http://marc.theaimsgroup.com/?t=113202715800001 Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre (cherry picked from 14c0fa243b358c24040ff5f44b60c47aaf6430c3 commit) --- drivers/ieee1394/hosts.h | 1 + drivers/ieee1394/nodemgr.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h index 38f42112dff..ae9b02cc013 100644 --- a/drivers/ieee1394/hosts.h +++ b/drivers/ieee1394/hosts.h @@ -41,6 +41,7 @@ struct hpsb_host { /* this nodes state */ unsigned in_bus_reset:1; unsigned is_shutdown:1; + unsigned resume_packet_sent:1; /* this nodes' duties on the bus */ unsigned is_root:1; diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 7fff5a1d2ea..f7c3dbaf580 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -1413,6 +1413,24 @@ static void nodemgr_node_probe(struct host_info *hi, int generation) return; } +static int nodemgr_send_resume_packet(struct hpsb_host *host) +{ + struct hpsb_packet *packet; + int ret = 1; + + packet = hpsb_make_phypacket(host, + 0x003c0000 | NODEID_TO_NODE(host->node_id) << 24); + if (packet) { + packet->no_waiter = 1; + packet->generation = get_hpsb_generation(host); + ret = hpsb_send_packet(packet); + } + if (ret) + HPSB_WARN("fw-host%d: Failed to broadcast resume packet", + host->id); + return ret; +} + /* Because we are a 1394a-2000 compliant IRM, we need to inform all the other * nodes of the broadcast channel. (Really we're only setting the validity * bit). Other IRM responsibilities go in here as well. */ @@ -1463,6 +1481,13 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) } } + /* Some devices suspend their ports while being connected to an inactive + * host adapter, i.e. if connected before the low-level driver is + * loaded. They become visible either when physically unplugged and + * replugged, or when receiving a resume packet. Send one once. */ + if (!host->resume_packet_sent && !nodemgr_send_resume_packet(host)) + host->resume_packet_sent = 1; + return 1; } -- cgit v1.2.3 From d51e86c18a479f1dbcef3aa20e58ad04d1233016 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Mon, 5 Dec 2005 16:28:59 -0500 Subject: ieee1394: write broadcast_channel only to select nodes (fixes device recognition) Some old 1394-1995 SBP-2 bridges would hang if they received a broadcast write request to BROADCAST_CHANNEL before the config ROM was read. Affected devices include Datafab MD2-FW2 2.5" HDD and SmartDisk VST FWCDRW-V8 portable CD writer. The write request is now directed to specific nodes instead of being broadcast to all nodes at once, and it is only performed if a previous read request at this register succeeded. Fixes an old interoperability problem which was perceived as a 2.6.14-specific regression: http://marc.theaimsgroup.com/?t=113190586800003 Signed-off-by: Stefan Richter Signed-off-by: Jody McIntyre (cherry picked from 61c7f775ca25ccfc0e51486103a724fb1a3a08f2 commit) --- drivers/ieee1394/nodemgr.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index f7c3dbaf580..0ea37b1bccb 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -1349,6 +1349,33 @@ static void nodemgr_update_pdrv(struct node_entry *ne) } +/* Write the BROADCAST_CHANNEL as per IEEE1394a 8.3.2.3.11 and 8.4.2.3. This + * seems like an optional service but in the end it is practically mandatory + * as a consequence of these clauses. + * + * Note that we cannot do a broadcast write to all nodes at once because some + * pre-1394a devices would hang. */ +static void nodemgr_irm_write_bc(struct node_entry *ne, int generation) +{ + const u64 bc_addr = (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL); + quadlet_t bc_remote, bc_local; + int ret; + + if (!ne->host->is_irm || ne->generation != generation || + ne->nodeid == ne->host->node_id) + return; + + bc_local = cpu_to_be32(ne->host->csr.broadcast_channel); + + /* Check if the register is implemented and 1394a compliant. */ + ret = hpsb_read(ne->host, ne->nodeid, generation, bc_addr, &bc_remote, + sizeof(bc_remote)); + if (!ret && bc_remote & cpu_to_be32(0x80000000) && + bc_remote != bc_local) + hpsb_node_write(ne, bc_addr, &bc_local, sizeof(bc_local)); +} + + static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int generation) { struct device *dev; @@ -1360,6 +1387,8 @@ static void nodemgr_probe_ne(struct host_info *hi, struct node_entry *ne, int ge if (!dev) return; + nodemgr_irm_write_bc(ne, generation); + /* If "needs_probe", then this is either a new or changed node we * rescan totally. If the generation matches for an existing node * (one that existed prior to the bus reset) we send update calls @@ -1431,9 +1460,7 @@ static int nodemgr_send_resume_packet(struct hpsb_host *host) return ret; } -/* Because we are a 1394a-2000 compliant IRM, we need to inform all the other - * nodes of the broadcast channel. (Really we're only setting the validity - * bit). Other IRM responsibilities go in here as well. */ +/* Perform a few high-level IRM responsibilities. */ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) { quadlet_t bc; @@ -1442,13 +1469,8 @@ static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles) if (!host->is_irm || host->irm_id == (nodeid_t)-1) return 1; - host->csr.broadcast_channel |= 0x40000000; /* set validity bit */ - - bc = cpu_to_be32(host->csr.broadcast_channel); - - hpsb_write(host, LOCAL_BUS | ALL_NODES, get_hpsb_generation(host), - (CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL), - &bc, sizeof(quadlet_t)); + /* We are a 1394a-2000 compliant IRM. Set the validity bit. */ + host->csr.broadcast_channel |= 0x40000000; /* If there is no bus manager then we should set the root node's * force_root bit to promote bus stability per the 1394 -- cgit v1.2.3 From 83bab9a4bbf91af93f45233dc288c4d26308e281 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 13 Dec 2005 02:58:07 +0100 Subject: [PATCH] allow KOBJECT_UEVENT=n only if EMBEDDED KOBJECT_UEVENT=n seems to be a common pitfall for udev users in 2.6.14 . -mm already contains a bigger patch removing this option that is IMHO too big for being applied now to 2.6.15-rc. This patch simply allows KOBJECT_UEVENT=n only if EMBEDDED. Signed-off-by: Adrian Bunk Signed-off-by: Linus Torvalds --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index ea097e0a9c0..59344616f47 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -206,7 +206,7 @@ config HOTPLUG outside the kernel tree does. Such modules require Y here. config KOBJECT_UEVENT - bool "Kernel Userspace Events" + bool "Kernel Userspace Events" if EMBEDDED depends on NET default y help -- cgit v1.2.3 From eed66cfcbbea851c97e287440d940286fce3f829 Mon Sep 17 00:00:00 2001 From: Tony Luck Date: Tue, 13 Dec 2005 10:41:49 -0800 Subject: [IA64] Split 16-bit severity field in sal_log_record_header ERR_SEVERITY item is defined as a 8 bits item in SAL documentation ($B.2.1 rev december 2003), but as an u16 in sal.h. This has the side effect that current code in mca.c may not call ia64_sal_clear_state_info() upon receiving corrected platform errors if there are bits set in the validation byte. Reported by Xavier Bru. Signed-off-by: Tony Luck --- include/asm-ia64/sal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h index 29df88bdd2b..313cad0628d 100644 --- a/include/asm-ia64/sal.h +++ b/include/asm-ia64/sal.h @@ -320,7 +320,8 @@ typedef struct sal_log_timestamp { typedef struct sal_log_record_header { u64 id; /* Unique monotonically increasing ID */ sal_log_revision_t revision; /* Major and Minor revision of header */ - u16 severity; /* Error Severity */ + u8 severity; /* Error Severity */ + u8 validation_bits; /* 0: platform_guid, 1: !timestamp */ u32 len; /* Length of this error log in bytes */ sal_log_timestamp_t timestamp; /* Timestamp */ efi_guid_t platform_guid; /* Unique OEM Platform ID */ -- cgit v1.2.3 From 0910b444bcd7ea7f437a3ff48e0e3d2495ead22e Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 13 Dec 2005 11:39:05 -0800 Subject: Expose "Optimize for size" option for everybody Let's put my money where my mouth is. Smaller code is almost always faster, if only because a single I$ miss ends up leaving a lot of cycles to make up for. And system software - kernels in particular - are known for taking more cache misses than most other kinds. On my random config, this made the kernel about 10% smaller, and lmbench seems to say that it's pretty uniformly faster too. Your milage may vary. Signed-off-by: Linus Torvalds --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 59344616f47..be74adb389e 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -339,7 +339,7 @@ config EPOLL support for epoll family of system calls. config CC_OPTIMIZE_FOR_SIZE - bool "Optimize for size" if EMBEDDED + bool "Optimize for size" default y if ARM || H8300 help Enabling this option will pass "-Os" instead of "-O2" to gcc -- cgit v1.2.3 From 322e079f1b606e46b79bb8b8e6cf6110b5f2aa3f Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 29 Nov 2005 23:08:40 -0500 Subject: [SCSI] Negotiate correctly with async-only devices When we got a device only capable of async, we would zero out goal->period which would cause us to try PPR negotiations. Leave goal->period alone, and check goal->offset before doing PPR. Kudos to Daniel Forsgren for figuring this out. Signed-off-by: Matthew Wilcox Signed-off-by: James Bottomley --- drivers/scsi/sym53c8xx_2/sym_hipd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index a7420cad454..1564ca203a3 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c @@ -1405,7 +1405,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget, goal->iu = 0; goal->dt = 0; goal->qas = 0; - goal->period = 0; goal->offset = 0; return; } @@ -1465,7 +1464,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp * Many devices implement PPR in a buggy way, so only use it if we * really want to. */ - if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { + if (goal->offset && + (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) { nego = NS_PPR; } else if (spi_width(starget) != goal->width) { nego = NS_WIDE; -- cgit v1.2.3 From 381291b7d3e17ac966498312dc571dcca1b93efc Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Tue, 13 Dec 2005 21:08:21 -0800 Subject: [TG3]: Fix nvram arbitration bugs. The nvram arbitration rules were not strictly followed in a few places and this could lead to reading corrupted values from the nvram. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 47bd4a39442..dabc39befd3 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -8533,6 +8533,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) { tp->tg3_flags |= TG3_FLAG_NVRAM; + tg3_nvram_lock(tp); tg3_enable_nvram_access(tp); if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) @@ -8543,6 +8544,7 @@ static void __devinit tg3_nvram_init(struct tg3 *tp) tg3_get_nvram_size(tp); tg3_disable_nvram_access(tp); + tg3_nvram_unlock(tp); } else { tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED); @@ -8640,10 +8642,10 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) if (ret == 0) *val = swab32(tr32(NVRAM_RDDATA)); - tg3_nvram_unlock(tp); - tg3_disable_nvram_access(tp); + tg3_nvram_unlock(tp); + return ret; } @@ -8728,6 +8730,10 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, offset = offset + (pagesize - page_off); + /* Nvram lock released by tg3_nvram_read() above, + * so need to get it again. + */ + tg3_nvram_lock(tp); tg3_enable_nvram_access(tp); /* -- cgit v1.2.3 From 6a9eba15f51c56da637e45ea1316eaa2a848986a Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Tue, 13 Dec 2005 21:08:58 -0800 Subject: [TG3]: Fix suspend and resume Fix tg3_suspend() and tg3_resume() by clearing and setting the TG3_FLAG_INIT_COMPLETE flag when appropriate. tg3_set_power_state() looks at TG3_FLAG_INIT_COMPLETE on the peer device to determine when to appropriately switch to aux power. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index dabc39befd3..6b7ab4b7275 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -10826,12 +10826,14 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state) tg3_full_lock(tp, 0); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); + tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; tg3_full_unlock(tp); err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); if (err) { tg3_full_lock(tp, 0); + tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; tg3_init_hw(tp); tp->timer.expires = jiffies + tp->timer_offset; @@ -10865,6 +10867,7 @@ static int tg3_resume(struct pci_dev *pdev) tg3_full_lock(tp, 0); + tp->tg3_flags |= TG3_FLAG_INIT_COMPLETE; tg3_init_hw(tp); tp->timer.expires = jiffies + tp->timer_offset; -- cgit v1.2.3 From 16fe9d74f14ed74af778c5db7f9129e29916f4a7 Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Tue, 13 Dec 2005 21:09:54 -0800 Subject: [TG3]: Fix 5704 single-port mode If the dual-port 5704 is configured as a single-port device with only one PCI function, it would trigger a BUG() condition in tg3_find_5704_peer(). This fixes the problem by returning its own pdev if the peer cannot be found. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 6b7ab4b7275..a143c18c7bc 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -10443,8 +10443,13 @@ static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) break; pci_dev_put(peer); } - if (!peer || peer == tp->pdev) - BUG(); + /* 5704 can be configured in single-port mode, set peer to + * tp->pdev in that case. + */ + if (!peer) { + peer = tp->pdev; + return peer; + } /* * We don't need to keep the refcount elevated; there's no way -- cgit v1.2.3 From 6921d201f77e14848df2eaa597e26525f468abea Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Tue, 13 Dec 2005 21:15:53 -0800 Subject: [TG3]: Fix low power state Fix the following bugs in tg3_set_power_state(): 1. Both WOL and ASF flags require switching to aux power. 2. Add a missing handshake with firmware to enable WOL. 3. Turn off the PHY if both WOL and ASF are disabled. 4. Add nvram arbitration before halting the firmware. 5. Fix tg3_setup_copper_phy() to switch to 100Mbps when changing to low power state. Update revision and date. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 44 +++++++++++++++++++++++++++++++++++++++----- drivers/net/tg3.h | 7 +++++++ 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index a143c18c7bc..a23ed28a72b 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -68,8 +68,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.44" -#define DRV_MODULE_RELDATE "Dec 6, 2005" +#define DRV_MODULE_VERSION "3.45" +#define DRV_MODULE_RELDATE "Dec 13, 2005" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -1025,7 +1025,9 @@ static void tg3_frob_aux_power(struct tg3 *tp) if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || - (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0) { + (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 || + (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || + (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) { if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) { tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | @@ -1105,6 +1107,8 @@ static int tg3_setup_phy(struct tg3 *, int); static void tg3_write_sig_post_reset(struct tg3 *, int); static int tg3_halt_cpu(struct tg3 *, u32); +static int tg3_nvram_lock(struct tg3 *); +static void tg3_nvram_unlock(struct tg3 *); static int tg3_set_power_state(struct tg3 *tp, int state) { @@ -1179,6 +1183,21 @@ static int tg3_set_power_state(struct tg3 *tp, int state) tg3_setup_phy(tp, 0); } + if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { + int i; + u32 val; + + for (i = 0; i < 200; i++) { + tg3_read_mem(tp, NIC_SRAM_FW_ASF_STATUS_MBOX, &val); + if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) + break; + msleep(1); + } + } + tg3_write_mem(tp, NIC_SRAM_WOL_MBOX, WOL_SIGNATURE | + WOL_DRV_STATE_SHUTDOWN | + WOL_DRV_WOL | WOL_SET_MAGIC_PKT); + pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps); if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) { @@ -1268,6 +1287,17 @@ static int tg3_set_power_state(struct tg3 *tp, int state) } } + if (!(tp->tg3_flags & TG3_FLAG_WOL_ENABLE) && + !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { + /* Turn off the PHY */ + if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { + tg3_writephy(tp, MII_TG3_EXT_CTRL, + MII_TG3_EXT_CTRL_FORCE_LED_OFF); + tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2); + tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); + } + } + tg3_frob_aux_power(tp); /* Workaround for unstable PLL clock */ @@ -1277,8 +1307,12 @@ static int tg3_set_power_state(struct tg3 *tp, int state) val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1); tw32(0x7d00, val); - if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) + if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { + tg3_nvram_lock(tp); tg3_halt_cpu(tp, RX_CPU_BASE); + tw32_f(NVRAM_SWARB, SWARB_REQ_CLR0); + tg3_nvram_unlock(tp); + } } /* Finally, set the new power state. */ @@ -1812,7 +1846,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, int force_reset) } } relink: - if (current_link_up == 0) { + if (current_link_up == 0 || tp->link_config.phy_is_low_power) { u32 tmp; tg3_phy_copper_begin(tp); diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index fb7e2a5f4a0..94dbcf3537e 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -1529,6 +1529,12 @@ #define NIC_SRAM_MAC_ADDR_HIGH_MBOX 0x00000c14 #define NIC_SRAM_MAC_ADDR_LOW_MBOX 0x00000c18 +#define NIC_SRAM_WOL_MBOX 0x00000d30 +#define WOL_SIGNATURE 0x474c0000 +#define WOL_DRV_STATE_SHUTDOWN 0x00000001 +#define WOL_DRV_WOL 0x00000002 +#define WOL_SET_MAGIC_PKT 0x00000004 + #define NIC_SRAM_DATA_CFG_2 0x00000d38 #define SHASTA_EXT_LED_MODE_MASK 0x00018000 @@ -1565,6 +1571,7 @@ #define MII_TG3_EXT_CTRL 0x10 /* Extended control register */ #define MII_TG3_EXT_CTRL_FIFO_ELASTIC 0x0001 #define MII_TG3_EXT_CTRL_LNK3_LED_MODE 0x0002 +#define MII_TG3_EXT_CTRL_FORCE_LED_OFF 0x0008 #define MII_TG3_EXT_CTRL_TBI 0x8000 #define MII_TG3_EXT_STAT 0x11 /* Extended status register */ -- cgit v1.2.3 From 664d22ab954de54e52e0f71103a89c7a78738adc Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Tue, 13 Dec 2005 17:03:36 -0800 Subject: [PATCH] Dmitry Torokhov is input subsystem maintainer I haven't been very actively maintaining the input layer in past months, mostly because of my lack of time to concentrate on that. For that reason, I've decided to pass the maintainership of the Linux Input Layer to Dmitry Torokhov, whom I trust to do the job very well. Signed-off-by: Vojtech Pavlik Cc: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 77bb0860691..da6973adacd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1284,8 +1284,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git S: Supported INPUT (KEYBOARD, MOUSE, JOYSTICK) DRIVERS -P: Vojtech Pavlik -M: vojtech@suse.cz +P: Dmitry Torokhov +M: dtor_core@ameritech.net L: linux-input@atrey.karlin.mff.cuni.cz L: linux-joystick@atrey.karlin.mff.cuni.cz T: git kernel.org:/pub/scm/linux/kernel/git/dtor/input.git -- cgit v1.2.3 From 118c71bcacce82a4317c9bd99c6a15af14020aee Mon Sep 17 00:00:00 2001 From: Yasunori Goto Date: Tue, 13 Dec 2005 17:03:37 -0800 Subject: [PATCH] Fix calculation of grow_pgdat_span() in mm/memory_hotplug.c The calculation for node_spanned_pages at grow_pgdat_span() is clearly wrong. This is patch for it. (Please see grow_zone_span() to compare. It is correct.) Signed-off-by: Yasunori Goto Acked-by: Dave Hansen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 431a64f021c..f6d4af8af8a 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -104,7 +104,7 @@ static void grow_pgdat_span(struct pglist_data *pgdat, pgdat->node_start_pfn = start_pfn; if (end_pfn > old_pgdat_end_pfn) - pgdat->node_spanned_pages = end_pfn - pgdat->node_spanned_pages; + pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn; } int online_pages(unsigned long pfn, unsigned long nr_pages) -- cgit v1.2.3 From fb79ffa4ddbe3f6f30fdb8429b5bad84d25ae6ef Mon Sep 17 00:00:00 2001 From: Ole Reinhardt Date: Tue, 13 Dec 2005 17:03:38 -0800 Subject: [PATCH] fbdev: make pxafb more robust to errors with CONFIG_FB_PXA_PARAMETERS pxafb.c runs into an oops if CONFIG_FB_PXA_PARAMETERS is enabled and no parameters are set in command line. The following patch avoids this problem. Signed-off-by: Nicolas Pitre Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/pxafb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 7b4cd250bec..9fc10b9e6f5 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -1396,7 +1396,8 @@ static struct platform_driver pxafb_driver = { int __devinit pxafb_setup(char *options) { # ifdef CONFIG_FB_PXA_PARAMETERS - strlcpy(g_options, options, sizeof(g_options)); + if (options) + strlcpy(g_options, options, sizeof(g_options)); # endif return 0; } -- cgit v1.2.3 From cd6104572bca9e4afe0dcdb8ecd65ef90b01297b Mon Sep 17 00:00:00 2001 From: Adam Kropelin Date: Tue, 13 Dec 2005 17:03:39 -0800 Subject: [PATCH] hid-core: Zero-pad truncated reports When it detects a truncated report, hid-core emits a warning and then processes the report as usual. This is good because it allows buggy devices to still get data thru to userspace. However, the missing bytes of the report should be cleared before processing, otherwise userspace will be handed partially-uninitialized data. This fixes Debian tracker bug #330487. Signed-off-by: Adam Kropelin Cc: Vojtech Pavlik Acked-by: Dmitry Torokhov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/usb/input/hid-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 45f3130fade..a3e44ef1df4 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -893,8 +893,10 @@ static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_ size = ((report->size - 1) >> 3) + 1; - if (len < size) + if (len < size) { dbg("report %d is too short, (%d < %d)", report->id, len, size); + memset(data + len, 0, size - len); + } if (hid->claimed & HID_CLAIMED_HIDDEV) hiddev_report_event(hid, report); -- cgit v1.2.3 From c9526497cf03ee775c3a6f8ba62335735f98de7a Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 9 Dec 2005 17:45:22 -0500 Subject: [SCSI] Consolidate REQ_BLOCK_PC handling path (fix ipod panic) This follows on from Jens' patch and consolidates all of the ULD separate handlers for REQ_BLOCK_PC into a single call which has his fix for our direction bug. Signed-off-by: James Bottomley --- drivers/scsi/scsi_lib.c | 33 +++++++++++++++++++++------------ drivers/scsi/sd.c | 16 +--------------- drivers/scsi/sr.c | 20 +++----------------- drivers/scsi/st.c | 19 +------------------ include/scsi/scsi_cmnd.h | 1 + 5 files changed, 27 insertions(+), 62 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 097888721ec..9be5769d44a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1078,6 +1078,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd) scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); } +void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries) +{ + struct request *req = cmd->request; + + BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); + memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); + cmd->cmd_len = req->cmd_len; + if (!req->data_len) + cmd->sc_data_direction = DMA_NONE; + else if (rq_data_dir(req) == WRITE) + cmd->sc_data_direction = DMA_TO_DEVICE; + else + cmd->sc_data_direction = DMA_FROM_DEVICE; + + cmd->transfersize = req->data_len; + cmd->allowed = retries; + cmd->timeout_per_command = req->timeout; +} +EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd); + static int scsi_prep_fn(struct request_queue *q, struct request *req) { struct scsi_device *sdev = q->queuedata; @@ -1213,18 +1233,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) goto kill; } } else { - memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); - cmd->cmd_len = req->cmd_len; - if (!req->data_len) - cmd->sc_data_direction = DMA_NONE; - else if (rq_data_dir(req) == WRITE) - cmd->sc_data_direction = DMA_TO_DEVICE; - else - cmd->sc_data_direction = DMA_FROM_DEVICE; - - cmd->transfersize = req->data_len; - cmd->allowed = 3; - cmd->timeout_per_command = req->timeout; + scsi_setup_blk_pc_cmnd(cmd, 3); cmd->done = scsi_generic_done; } } diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8613a131771..03fcbab3003 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) * SG_IO from block layer already setup, just copy cdb basically */ if (blk_pc_request(rq)) { - if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) - return 0; - - memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd)); - SCpnt->cmd_len = rq->cmd_len; - if (rq_data_dir(rq) == WRITE) - SCpnt->sc_data_direction = DMA_TO_DEVICE; - else if (rq->data_len) - SCpnt->sc_data_direction = DMA_FROM_DEVICE; - else - SCpnt->sc_data_direction = DMA_NONE; - - this_count = rq->data_len; + scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES); if (rq->timeout) timeout = rq->timeout; - SCpnt->transfersize = rq->data_len; - SCpnt->allowed = SD_PASSTHROUGH_RETRIES; goto queue; } diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index d68cea753bb..fb4012b5c18 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) * these are already setup, just copy cdb basically */ if (SCpnt->request->flags & REQ_BLOCK_PC) { - struct request *rq = SCpnt->request; + scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES); - if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) - return 0; - - memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd)); - SCpnt->cmd_len = rq->cmd_len; - if (!rq->data_len) - SCpnt->sc_data_direction = DMA_NONE; - else if (rq_data_dir(rq) == WRITE) - SCpnt->sc_data_direction = DMA_TO_DEVICE; - else - SCpnt->sc_data_direction = DMA_FROM_DEVICE; - - this_count = rq->data_len; - if (rq->timeout) - timeout = rq->timeout; + if (SCpnt->timeout_per_command) + timeout = SCpnt->timeout_per_command; - SCpnt->transfersize = rq->data_len; goto queue; } diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 7ac6ea141ff..dd592f6a252 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -4194,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt) */ static int st_init_command(struct scsi_cmnd *SCpnt) { - struct request *rq; - if (!(SCpnt->request->flags & REQ_BLOCK_PC)) return 0; - rq = SCpnt->request; - if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) - return 0; - - memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd)); - SCpnt->cmd_len = rq->cmd_len; - - if (rq_data_dir(rq) == WRITE) - SCpnt->sc_data_direction = DMA_TO_DEVICE; - else if (rq->data_len) - SCpnt->sc_data_direction = DMA_FROM_DEVICE; - else - SCpnt->sc_data_direction = DMA_NONE; - - SCpnt->timeout_per_command = rq->timeout; - SCpnt->transfersize = rq->data_len; + scsi_setup_blk_pc_cmnd(SCpnt, 0); SCpnt->done = st_intr; return 1; } diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 7529f4388bb..20da282d4ab 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -151,5 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); extern void scsi_put_command(struct scsi_cmnd *); extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); extern void scsi_finish_command(struct scsi_cmnd *cmd); +extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries); #endif /* _SCSI_SCSI_CMND_H */ -- cgit v1.2.3 From a1493d9cd1aaed06860d128a37df1bdfbc61f7c8 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 13 Dec 2005 22:59:36 -0800 Subject: [IPV6] addrconf: Do not print device pointer in privacy log message. Noticed by Andi Kleen, it is pointless to emit the device structure pointer in the kernel logs like this. Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 76ff9f4fe89..73a23b4130a 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -379,8 +379,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) dev->type == ARPHRD_NONE || dev->type == ARPHRD_SIT) { printk(KERN_INFO - "Disabled Privacy Extensions on device %p(%s)\n", - dev, dev->name); + "%s: Disabled Privacy Extensions\n", + dev->name); ndev->cnf.use_tempaddr = -1; } else { in6_dev_hold(ndev); -- cgit v1.2.3 From 2edc2689f8183dd21c45621a01580b340ac420ba Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 13 Dec 2005 22:59:50 -0800 Subject: [PKT_SCHED]: Disable debug tracing logs by default in packet action API. Noticed by Andi Kleen. Signed-off-by: David S. Miller --- net/sched/act_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 8aebe8f6d27..2ce1cb2aa2e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -34,7 +34,7 @@ #include #include -#if 1 /* control */ +#if 0 /* control */ #define DPRINTK(format, args...) printk(KERN_DEBUG format, ##args) #else #define DPRINTK(format, args...) -- cgit v1.2.3 From 45f8245b972e360c19aec9032e2a2033b8ac3719 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 14 Dec 2005 14:57:35 +0000 Subject: [MMC] Explain the internals of mmc_power_up() It seems that people get confused about what is happening in mmc_power_up(). Add a comment to make it clear why we have a two stage process. Signed-off-by: Russell King --- drivers/mmc/mmc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index b586a83a9b4..eb41391e06e 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -679,7 +679,15 @@ static void mmc_idle_cards(struct mmc_host *host) } /* - * Apply power to the MMC stack. + * Apply power to the MMC stack. This is a two-stage process. + * First, we enable power to the card without the clock running. + * We then wait a bit for the power to stabilise. Finally, + * enable the bus drivers and clock to the card. + * + * We must _NOT_ enable the clock prior to power stablising. + * + * If a host does all the power sequencing itself, ignore the + * initial MMC_POWER_UP stage. */ static void mmc_power_up(struct mmc_host *host) { -- cgit v1.2.3 From 27af4cfd11883073359bd5acab1962b0fa96a3bf Mon Sep 17 00:00:00 2001 From: Robin Holt Date: Wed, 14 Dec 2005 06:58:05 -0600 Subject: [IA64] fix for SET_PERSONALITY when CONFIG_IA32_SUPPORT is not set. Missed this when fixing the SET_PERSONALITY change. Signed-off-by: Robin Holt Signed-off-by: Tony Luck --- arch/ia64/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index a4da715a360..e9904c74d2b 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -721,11 +721,13 @@ flush_thread (void) /* drop floating-point and debug-register state if it exists: */ current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); ia64_drop_fpu(current); +#ifdef CONFIG_IA32_SUPPORT if (IS_IA32_PROCESS(ia64_task_regs(current))) { ia32_drop_partial_page_list(current); current->thread.task_size = IA32_PAGE_OFFSET; set_fs(USER_DS); } +#endif } /* -- cgit v1.2.3 From 1542272a60ab9c0655a13ead8b7d7a661365f9fb Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Wed, 14 Dec 2005 12:55:24 -0800 Subject: [GRE]: Fix hardware checksum modification The skb_postpull_rcsum introduced a bug to the checksum modification. Although the length pulled is offset bytes, the origin of the pulling is the GRE header, not the IP header. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- net/ipv4/ip_gre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index a4c347c3b8e..46f9d9cf7a5 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -618,7 +618,7 @@ static int ipgre_rcv(struct sk_buff *skb) skb->mac.raw = skb->nh.raw; skb->nh.raw = __pskb_pull(skb, offset); - skb_postpull_rcsum(skb, skb->mac.raw, offset); + skb_postpull_rcsum(skb, skb->h.raw, offset); memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); skb->pkt_type = PACKET_HOST; #ifdef CONFIG_NET_IPGRE_BROADCAST -- cgit v1.2.3 From c2e2611425a956d25d2948c5d95d3848c4db1257 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 14 Dec 2005 22:04:22 +0000 Subject: [ARM] 3205/1: Handle new EABI relocations when loading kernel modules. Patch from Daniel Jacobowitz Handle new EABI relocations when loading kernel modules. This is necessary for CONFIG_AEABI kernels, and also for some broken (since fixed) old ABI toolchains. Signed-off-by: Daniel Jacobowitz Signed-off-by: Russell King --- arch/arm/kernel/module.c | 2 ++ include/asm-arm/elf.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 6055e1427ba..055bf5d2889 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -101,6 +101,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, break; case R_ARM_PC24: + case R_ARM_CALL: + case R_ARM_JUMP24: offset = (*(u32 *)loc & 0x00ffffff) << 2; if (offset & 0x02000000) offset -= 0x04000000; diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index 7da97a93754..2d44b42d184 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -22,6 +22,8 @@ typedef unsigned long elf_freg_t[3]; #define R_ARM_NONE 0 #define R_ARM_PC24 1 #define R_ARM_ABS32 2 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; -- cgit v1.2.3 From a388442c3798a345d131ff8b9d6dea0bfda3fefc Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 14 Dec 2005 16:23:16 -0800 Subject: [VLAN]: Fix hardware rx csum errors Receiving VLAN packets over a device (without VLAN assist) that is doing hardware checksumming (CHECKSUM_HW), causes errors because the VLAN code forgets to adjust the hardware checksum. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- net/8021q/vlan_dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index b7486488967..f2a8750bbf1 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -165,6 +165,9 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, skb_pull(skb, VLAN_HLEN); /* take off the VLAN header (4 bytes currently) */ + /* Need to correct hardware checksum */ + skb_postpull_rcsum(skb, vhdr, VLAN_HLEN); + /* Ok, lets check to make sure the device (dev) we * came in on is what this VLAN is attached to. */ -- cgit v1.2.3 From deb5e5c0c68e59b1bf9ede66da9e6a89f6557595 Mon Sep 17 00:00:00 2001 From: Jeremy Higdon Date: Thu, 15 Dec 2005 02:10:35 +0100 Subject: [PATCH] sgiioc4: check for no hwifs available Add a check to the sgiioc4 driver for the case where all available ide_hwifs structures are in use. Signed-off-by: Jeremy Higdon Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/sgiioc4.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index af526b671c4..4ee597d0879 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -622,12 +622,18 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d) ide_hwif_t *hwif; int h; + /* + * Find an empty HWIF; if none available, return -ENOMEM. + */ for (h = 0; h < MAX_HWIFS; ++h) { hwif = &ide_hwifs[h]; - /* Find an empty HWIF */ if (hwif->chipset == ide_unknown) break; } + if (h == MAX_HWIFS) { + printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n", d->name); + return -ENOMEM; + } /* Get the CmdBlk and CtrlBlk Base Registers */ base = pci_resource_start(dev, 0) + IOC4_CMD_OFFSET; -- cgit v1.2.3 From ceef833bae05e393859f1946a9802fb61f0febdf Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 15 Dec 2005 02:11:55 +0100 Subject: [PATCH] via82cxxx IDE: Add VT8251 ISA bridge Some motherboards (such as the Asus P5V800-MX) ship a PCI_DEVICE_ID_VIA_82C586_1 IDE controller alongside a VT8251 southbridge. This southbridge is currently unrecognised in the via82cxxx IDE driver, preventing those users from getting DMA access to disks. Signed-off-by: Daniel Drake Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 1 + include/linux/pci_ids.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 7161ce0ef5a..86fb1e0286d 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -80,6 +80,7 @@ static struct via_isa_bridge { u16 flags; } via_isa_bridges[] = { { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, + { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 1e737e269db..4db67b3b05c 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1244,6 +1244,7 @@ #define PCI_DEVICE_ID_VIA_8378_0 0x3205 #define PCI_DEVICE_ID_VIA_8783_0 0x3208 #define PCI_DEVICE_ID_VIA_8237 0x3227 +#define PCI_DEVICE_ID_VIA_8251 0x3287 #define PCI_DEVICE_ID_VIA_3296_0 0x0296 #define PCI_DEVICE_ID_VIA_8231 0x8231 #define PCI_DEVICE_ID_VIA_8231_4 0x8235 -- cgit v1.2.3 From 38f9d412be1ed29ee3b41782f22fd85b1c95fbed Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Thu, 15 Dec 2005 02:12:53 +0100 Subject: [PATCH] ide: MPC8xx IDE depends on IDE=y && BLK_DEV_IDE=y The following patch adds a dependancy on IDE=y && BLK_DEV_IDE=y for the MPC8xx IDE driver. The code is not modular at the moment (init called from platform setup code). Signed-off-by: Marcelo Tosatti Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 31e649a9ff7..45579ae12c0 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -940,7 +940,7 @@ config BLK_DEV_Q40IDE config BLK_DEV_MPC8xx_IDE bool "MPC8xx IDE support" - depends on 8xx + depends on 8xx && IDE=y && BLK_DEV_IDE=y help This option provides support for IDE on Motorola MPC8xx Systems. Please see 'Type of MPC8xx IDE interface' for details. -- cgit v1.2.3 From 65e5f2e3b457b6b20a5c4481312189d141a33d24 Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Thu, 15 Dec 2005 02:16:18 +0100 Subject: [PATCH] ide: core modifications for AU1200 bart: slightly modified by me Signed-off-by: Jordan Crouse Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 15 ++++++--------- include/asm-mips/mach-au1x00/au1xxx_ide.h | 5 ----- include/linux/ide.h | 6 ++++++ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 1e1531334c2..0523da77425 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -90,11 +90,6 @@ #include #include -struct drive_list_entry { - const char *id_model; - const char *id_firmware; -}; - static const struct drive_list_entry drive_whitelist [] = { { "Micropolis 2112A" , "ALL" }, @@ -139,7 +134,7 @@ static const struct drive_list_entry drive_blacklist [] = { }; /** - * in_drive_list - look for drive in black/white list + * ide_in_drive_list - look for drive in black/white list * @id: drive identifier * @drive_table: list to inspect * @@ -147,7 +142,7 @@ static const struct drive_list_entry drive_blacklist [] = { * Returns 1 if the drive is found in the table. */ -static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) +int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) { for ( ; drive_table->id_model ; drive_table++) if ((!strcmp(drive_table->id_model, id->model)) && @@ -157,6 +152,8 @@ static int in_drive_list(struct hd_driveid *id, const struct drive_list_entry *d return 0; } +EXPORT_SYMBOL_GPL(ide_in_drive_list); + /** * ide_dma_intr - IDE DMA interrupt handler * @drive: the drive the interrupt is for @@ -663,7 +660,7 @@ int __ide_dma_bad_drive (ide_drive_t *drive) { struct hd_driveid *id = drive->id; - int blacklist = in_drive_list(id, drive_blacklist); + int blacklist = ide_in_drive_list(id, drive_blacklist); if (blacklist) { printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", drive->name, id->model); @@ -677,7 +674,7 @@ EXPORT_SYMBOL(__ide_dma_bad_drive); int __ide_dma_good_drive (ide_drive_t *drive) { struct hd_driveid *id = drive->id; - return in_drive_list(id, drive_whitelist); + return ide_in_drive_list(id, drive_whitelist); } EXPORT_SYMBOL(__ide_dma_good_drive); diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h index 33d275c3b84..0c3c127e619 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_ide.h +++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h @@ -87,11 +87,6 @@ typedef struct } _auide_hwif; #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -struct drive_list_entry { - const char * id_model; - const char * id_firmware; -}; - /* HD white list */ static const struct drive_list_entry dma_white_list [] = { /* diff --git a/include/linux/ide.h b/include/linux/ide.h index a39c3c59789..a6b28dcf8f0 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1371,6 +1371,12 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *); #define GOOD_DMA_DRIVE 1 #ifdef CONFIG_BLK_DEV_IDEDMA +struct drive_list_entry { + const char *id_model; + const char *id_firmware; +}; + +int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); int __ide_dma_bad_drive(ide_drive_t *); int __ide_dma_good_drive(ide_drive_t *); int ide_use_dma(ide_drive_t *); -- cgit v1.2.3 From 8f29e650bffc1e22ed6b2d0b321bc77627f3bb7a Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Thu, 15 Dec 2005 02:17:46 +0100 Subject: [PATCH] ide: AU1200 IDE update Changes here include removing all of CONFIG_PM while it is being repeatedly smacked with a lead pipe, moving the BURSTMODE param to a #define (it should be defined almost always anyway), fixing the rqsize stuff, pulling ide_ioreg_t, and general cleanups and whatnot. Signed-off-by: Jordan Crouse Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 8 - drivers/ide/mips/Makefile | 3 + drivers/ide/mips/au1xxx-ide.c | 1498 ++++++++++------------------- include/asm-mips/mach-au1x00/au1xxx_ide.h | 17 +- 4 files changed, 543 insertions(+), 983 deletions(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 45579ae12c0..1c81174595b 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -807,14 +807,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX endchoice -config BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - bool "Enable burstable Mode on DbDMA" - default false - depends BLK_DEV_IDE_AU1XXX - help - This option enable the burstable Flag on DbDMA controller - (cf. "AMD Alchemy 'Au1200' Processor Data Book - PRELIMINARY"). - config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ int "Maximum transfer size (KB) per request (up to 128)" default "128" diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile index 578e52a5958..677c7b2bac9 100644 --- a/drivers/ide/mips/Makefile +++ b/drivers/ide/mips/Makefile @@ -1 +1,4 @@ obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o +obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o + +EXTRA_CFLAGS := -Idrivers/ide diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 2b6327c576b..32431dcf5d8 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -31,865 +31,638 @@ */ #undef REALLY_SLOW_IO /* most systems can safely undef this */ -#include /* for CONFIG_BLK_DEV_IDEPCI */ #include #include #include #include -#include -#include -#include -#include +#include + #include #include #include #include +#include "ide-timing.h" + #include #include #include -#if CONFIG_PM -#include -#endif - #include #define DRV_NAME "au1200-ide" #define DRV_VERSION "1.0" -#define DRV_AUTHOR "AMD PCS / Pete Popov " -#define DRV_DESC "Au1200 IDE" - -static _auide_hwif auide_hwif; -static spinlock_t ide_tune_drive_spin_lock = SPIN_LOCK_UNLOCKED; -static spinlock_t ide_tune_chipset_spin_lock = SPIN_LOCK_UNLOCKED; -static int dbdma_init_done = 0; - -/* - * local I/O functions - */ -u8 auide_inb(unsigned long port) -{ - return (au_readb(port)); -} +#define DRV_AUTHOR "Enrico Walther / Pete Popov " -u16 auide_inw(unsigned long port) -{ - return (au_readw(port)); -} +/* enable the burstmode in the dbdma */ +#define IDE_AU1XXX_BURSTMODE 1 -u32 auide_inl(unsigned long port) -{ - return (au_readl(port)); -} +static _auide_hwif auide_hwif; +static int dbdma_init_done; -void auide_insw(unsigned long port, void *addr, u32 count) -{ #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) - _auide_hwif *ahwif = &auide_hwif; - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; - - if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, - DDMA_FLAGS_NOIE)) { - printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); - return; - } - ctp = *((chan_tab_t **)ahwif->rx_chan); - dp = ctp->cur_ptr; - while (dp->dscr_cmd0 & DSCR_CMD0_V) - ; - ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); -#else - while (count--) - { - *(u16 *)addr = au_readw(port); - addr +=2 ; - } -#endif -} - -void auide_insl(unsigned long port, void *addr, u32 count) -{ - while (count--) - { - *(u32 *)addr = au_readl(port); - /* NOTE: For IDE interfaces over PCMCIA, - * 32-bit access does not work - */ - addr += 4; - } -} - -void auide_outb(u8 addr, unsigned long port) +void auide_insw(unsigned long port, void *addr, u32 count) { - return (au_writeb(addr, port)); -} + _auide_hwif *ahwif = &auide_hwif; + chan_tab_t *ctp; + au1x_ddma_desc_t *dp; -void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port) -{ - return (au_writeb(addr, port)); + if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, + DDMA_FLAGS_NOIE)) { + printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); + return; + } + ctp = *((chan_tab_t **)ahwif->rx_chan); + dp = ctp->cur_ptr; + while (dp->dscr_cmd0 & DSCR_CMD0_V) + ; + ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); } -void auide_outw(u16 addr, unsigned long port) +void auide_outsw(unsigned long port, void *addr, u32 count) { - return (au_writew(addr, port)); -} + _auide_hwif *ahwif = &auide_hwif; + chan_tab_t *ctp; + au1x_ddma_desc_t *dp; -void auide_outl(u32 addr, unsigned long port) -{ - return (au_writel(addr, port)); + if(!put_source_flags(ahwif->tx_chan, (void*)addr, + count << 1, DDMA_FLAGS_NOIE)) { + printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); + return; + } + ctp = *((chan_tab_t **)ahwif->tx_chan); + dp = ctp->cur_ptr; + while (dp->dscr_cmd0 & DSCR_CMD0_V) + ; + ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); } -void auide_outsw(unsigned long port, void *addr, u32 count) -{ -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) - _auide_hwif *ahwif = &auide_hwif; - chan_tab_t *ctp; - au1x_ddma_desc_t *dp; - - if(!put_source_flags(ahwif->tx_chan, (void*)addr, - count << 1, DDMA_FLAGS_NOIE)) { - printk(KERN_ERR "%s failed %d\n", __FUNCTION__, __LINE__); - return; - } - ctp = *((chan_tab_t **)ahwif->tx_chan); - dp = ctp->cur_ptr; - while (dp->dscr_cmd0 & DSCR_CMD0_V) - ; - ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); -#else - while (count--) - { - au_writew(*(u16 *)addr, port); - addr += 2; - } #endif -} - -void auide_outsl(unsigned long port, void *addr, u32 count) -{ - while (count--) - { - au_writel(*(u32 *)addr, port); - /* NOTE: For IDE interfaces over PCMCIA, - * 32-bit access does not work - */ - addr += 4; - } -} static void auide_tune_drive(ide_drive_t *drive, byte pio) { - int mem_sttime; - int mem_stcfg; - unsigned long flags; - u8 speed; - - /* get the best pio mode for the drive */ - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); - - printk("%s: setting Au1XXX IDE to PIO mode%d\n", - drive->name, pio); - - spin_lock_irqsave(&ide_tune_drive_spin_lock, flags); - - mem_sttime = 0; - mem_stcfg = au_readl(MEM_STCFG2); - - /* set pio mode! */ - switch(pio) { - case 0: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_PIO0_TWCS - | SBC_IDE_PIO0_TCSH - | SBC_IDE_PIO0_TCSOFF - | SBC_IDE_PIO0_TWP - | SBC_IDE_PIO0_TCSW - | SBC_IDE_PIO0_TPM - | SBC_IDE_PIO0_TA; - /* set configuration for RCS2# */ - mem_stcfg |= TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS; - - au_writel(mem_sttime,MEM_STTIME2); - au_writel(mem_stcfg,MEM_STCFG2); - break; - - case 1: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_PIO1_TWCS - | SBC_IDE_PIO1_TCSH - | SBC_IDE_PIO1_TCSOFF - | SBC_IDE_PIO1_TWP - | SBC_IDE_PIO1_TCSW - | SBC_IDE_PIO1_TPM - | SBC_IDE_PIO1_TA; - /* set configuration for RCS2# */ - mem_stcfg |= TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS; - break; - - case 2: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_PIO2_TWCS - | SBC_IDE_PIO2_TCSH - | SBC_IDE_PIO2_TCSOFF - | SBC_IDE_PIO2_TWP - | SBC_IDE_PIO2_TCSW - | SBC_IDE_PIO2_TPM - | SBC_IDE_PIO2_TA; - /* set configuration for RCS2# */ - mem_stcfg &= ~TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS; - break; - - case 3: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_PIO3_TWCS - | SBC_IDE_PIO3_TCSH - | SBC_IDE_PIO3_TCSOFF - | SBC_IDE_PIO3_TWP - | SBC_IDE_PIO3_TCSW - | SBC_IDE_PIO3_TPM - | SBC_IDE_PIO3_TA; - /* set configuration for RCS2# */ - mem_stcfg |= TS_MASK; - mem_stcfg &= ~TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS; - - break; - - case 4: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_PIO4_TWCS - | SBC_IDE_PIO4_TCSH - | SBC_IDE_PIO4_TCSOFF - | SBC_IDE_PIO4_TWP - | SBC_IDE_PIO4_TCSW - | SBC_IDE_PIO4_TPM - | SBC_IDE_PIO4_TA; - /* set configuration for RCS2# */ - mem_stcfg &= ~TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS; - break; - } - - au_writel(mem_sttime,MEM_STTIME2); - au_writel(mem_stcfg,MEM_STCFG2); - - spin_unlock_irqrestore(&ide_tune_drive_spin_lock, flags); - - speed = pio + XFER_PIO_0; - ide_config_drive_speed(drive, speed); + int mem_sttime; + int mem_stcfg; + u8 speed; + + /* get the best pio mode for the drive */ + pio = ide_get_best_pio_mode(drive, pio, 4, NULL); + + printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", + drive->name, pio); + + mem_sttime = 0; + mem_stcfg = au_readl(MEM_STCFG2); + + /* set pio mode! */ + switch(pio) { + case 0: + mem_sttime = SBC_IDE_TIMING(PIO0); + + /* set configuration for RCS2# */ + mem_stcfg |= TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_PIO0_TCSOE | SBC_IDE_PIO0_TOECS; + break; + + case 1: + mem_sttime = SBC_IDE_TIMING(PIO1); + + /* set configuration for RCS2# */ + mem_stcfg |= TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_PIO1_TCSOE | SBC_IDE_PIO1_TOECS; + break; + + case 2: + mem_sttime = SBC_IDE_TIMING(PIO2); + + /* set configuration for RCS2# */ + mem_stcfg &= ~TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_PIO2_TCSOE | SBC_IDE_PIO2_TOECS; + break; + + case 3: + mem_sttime = SBC_IDE_TIMING(PIO3); + + /* set configuration for RCS2# */ + mem_stcfg &= ~TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_PIO3_TCSOE | SBC_IDE_PIO3_TOECS; + + break; + + case 4: + mem_sttime = SBC_IDE_TIMING(PIO4); + + /* set configuration for RCS2# */ + mem_stcfg &= ~TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_PIO4_TCSOE | SBC_IDE_PIO4_TOECS; + break; + } + + au_writel(mem_sttime,MEM_STTIME2); + au_writel(mem_stcfg,MEM_STCFG2); + + speed = pio + XFER_PIO_0; + ide_config_drive_speed(drive, speed); } static int auide_tune_chipset (ide_drive_t *drive, u8 speed) { - u8 mode = 0; - int mem_sttime; - int mem_stcfg; - unsigned long flags; + int mem_sttime; + int mem_stcfg; + unsigned long mode; + #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - struct hd_driveid *id = drive->id; - - /* - * Now see what the current drive is capable of, - * selecting UDMA only if the mate said it was ok. - */ - if (id && (id->capability & 1) && drive->autodma && - !__ide_dma_bad_drive(drive)) { - if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) { - if (id->dma_mword & 4) - mode = XFER_MW_DMA_2; - else if (id->dma_mword & 2) - mode = XFER_MW_DMA_1; - else if (id->dma_mword & 1) - mode = XFER_MW_DMA_0; - } - } + if (ide_use_dma(drive)) + mode = ide_dma_speed(drive, 0); #endif - spin_lock_irqsave(&ide_tune_chipset_spin_lock, flags); + mem_sttime = 0; + mem_stcfg = au_readl(MEM_STCFG2); - mem_sttime = 0; - mem_stcfg = au_readl(MEM_STCFG2); - - switch(speed) { - case XFER_PIO_4: - case XFER_PIO_3: - case XFER_PIO_2: - case XFER_PIO_1: - case XFER_PIO_0: - auide_tune_drive(drive, (speed - XFER_PIO_0)); - break; + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { + auide_tune_drive(drive, speed - XFER_PIO_0); + return 0; + } + + switch(speed) { #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - case XFER_MW_DMA_2: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_MDMA2_TWCS - | SBC_IDE_MDMA2_TCSH - | SBC_IDE_MDMA2_TCSOFF - | SBC_IDE_MDMA2_TWP - | SBC_IDE_MDMA2_TCSW - | SBC_IDE_MDMA2_TPM - | SBC_IDE_MDMA2_TA; - /* set configuration for RCS2# */ - mem_stcfg &= ~TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS; - - mode = XFER_MW_DMA_2; - break; - case XFER_MW_DMA_1: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_MDMA1_TWCS - | SBC_IDE_MDMA1_TCSH - | SBC_IDE_MDMA1_TCSOFF - | SBC_IDE_MDMA1_TWP - | SBC_IDE_MDMA1_TCSW - | SBC_IDE_MDMA1_TPM - | SBC_IDE_MDMA1_TA; - /* set configuration for RCS2# */ - mem_stcfg &= ~TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS; - - mode = XFER_MW_DMA_1; - break; - case XFER_MW_DMA_0: - /* set timing parameters for RCS2# */ - mem_sttime = SBC_IDE_MDMA0_TWCS - | SBC_IDE_MDMA0_TCSH - | SBC_IDE_MDMA0_TCSOFF - | SBC_IDE_MDMA0_TWP - | SBC_IDE_MDMA0_TCSW - | SBC_IDE_MDMA0_TPM - | SBC_IDE_MDMA0_TA; - /* set configuration for RCS2# */ - mem_stcfg |= TS_MASK; - mem_stcfg &= ~TCSOE_MASK; - mem_stcfg &= ~TOECS_MASK; - mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS; - - mode = XFER_MW_DMA_0; - break; + case XFER_MW_DMA_2: + mem_sttime = SBC_IDE_TIMING(MDMA2); + + /* set configuration for RCS2# */ + mem_stcfg &= ~TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_MDMA2_TCSOE | SBC_IDE_MDMA2_TOECS; + + mode = XFER_MW_DMA_2; + break; + case XFER_MW_DMA_1: + mem_sttime = SBC_IDE_TIMING(MDMA1); + + /* set configuration for RCS2# */ + mem_stcfg &= ~TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_MDMA1_TCSOE | SBC_IDE_MDMA1_TOECS; + + mode = XFER_MW_DMA_1; + break; + case XFER_MW_DMA_0: + mem_sttime = SBC_IDE_TIMING(MDMA0); + + /* set configuration for RCS2# */ + mem_stcfg |= TS_MASK; + mem_stcfg &= ~TCSOE_MASK; + mem_stcfg &= ~TOECS_MASK; + mem_stcfg |= SBC_IDE_MDMA0_TCSOE | SBC_IDE_MDMA0_TOECS; + + mode = XFER_MW_DMA_0; + break; #endif - default: - return 1; - } - - /* - * Tell the drive to switch to the new mode; abort on failure. - */ - if (!mode || ide_config_drive_speed(drive, mode)) - { - return 1; /* failure */ - } - - - au_writel(mem_sttime,MEM_STTIME2); - au_writel(mem_stcfg,MEM_STCFG2); + default: + return 1; + } + + if (ide_config_drive_speed(drive, mode)) + return 1; - spin_unlock_irqrestore(&ide_tune_chipset_spin_lock, flags); + au_writel(mem_sttime,MEM_STTIME2); + au_writel(mem_stcfg,MEM_STCFG2); - return 0; + return 0; } /* * Multi-Word DMA + DbDMA functions */ -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -static int in_drive_list(struct hd_driveid *id, - const struct drive_list_entry *drive_table) -{ - for ( ; drive_table->id_model ; drive_table++){ - if ((!strcmp(drive_table->id_model, id->model)) && - ((strstr(drive_table->id_firmware, id->fw_rev)) || - (!strcmp(drive_table->id_firmware, "ALL"))) - ) - return 1; - } - return 0; -} +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static int auide_build_sglist(ide_drive_t *drive, struct request *rq) { - ide_hwif_t *hwif = drive->hwif; - _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; - struct scatterlist *sg = hwif->sg_table; + ide_hwif_t *hwif = drive->hwif; + _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; + struct scatterlist *sg = hwif->sg_table; - ide_map_sg(drive, rq); + ide_map_sg(drive, rq); - if (rq_data_dir(rq) == READ) - hwif->sg_dma_direction = DMA_FROM_DEVICE; - else - hwif->sg_dma_direction = DMA_TO_DEVICE; + if (rq_data_dir(rq) == READ) + hwif->sg_dma_direction = DMA_FROM_DEVICE; + else + hwif->sg_dma_direction = DMA_TO_DEVICE; - return dma_map_sg(ahwif->dev, sg, hwif->sg_nents, - hwif->sg_dma_direction); + return dma_map_sg(ahwif->dev, sg, hwif->sg_nents, + hwif->sg_dma_direction); } static int auide_build_dmatable(ide_drive_t *drive) { - int i, iswrite, count = 0; - ide_hwif_t *hwif = HWIF(drive); - - struct request *rq = HWGROUP(drive)->rq; - - _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; - struct scatterlist *sg; - - iswrite = (rq_data_dir(rq) == WRITE); - /* Save for interrupt context */ - ahwif->drive = drive; - - /* Build sglist */ - hwif->sg_nents = i = auide_build_sglist(drive, rq); - - if (!i) - return 0; - - /* fill the descriptors */ - sg = hwif->sg_table; - while (i && sg_dma_len(sg)) { - u32 cur_addr; - u32 cur_len; - - cur_addr = sg_dma_address(sg); - cur_len = sg_dma_len(sg); - - while (cur_len) { - u32 flags = DDMA_FLAGS_NOIE; - unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; - - if (++count >= PRD_ENTRIES) { - printk(KERN_WARNING "%s: DMA table too small\n", - drive->name); - goto use_pio_instead; - } - - /* Lets enable intr for the last descriptor only */ - if (1==i) - flags = DDMA_FLAGS_IE; - else - flags = DDMA_FLAGS_NOIE; - - if (iswrite) { - if(!put_source_flags(ahwif->tx_chan, - (void*)(page_address(sg->page) - + sg->offset), - tc, flags)) { - printk(KERN_ERR "%s failed %d\n", - __FUNCTION__, __LINE__); + int i, iswrite, count = 0; + ide_hwif_t *hwif = HWIF(drive); + + struct request *rq = HWGROUP(drive)->rq; + + _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; + struct scatterlist *sg; + + iswrite = (rq_data_dir(rq) == WRITE); + /* Save for interrupt context */ + ahwif->drive = drive; + + /* Build sglist */ + hwif->sg_nents = i = auide_build_sglist(drive, rq); + + if (!i) + return 0; + + /* fill the descriptors */ + sg = hwif->sg_table; + while (i && sg_dma_len(sg)) { + u32 cur_addr; + u32 cur_len; + + cur_addr = sg_dma_address(sg); + cur_len = sg_dma_len(sg); + + while (cur_len) { + u32 flags = DDMA_FLAGS_NOIE; + unsigned int tc = (cur_len < 0xfe00)? cur_len: 0xfe00; + + if (++count >= PRD_ENTRIES) { + printk(KERN_WARNING "%s: DMA table too small\n", + drive->name); + goto use_pio_instead; + } + + /* Lets enable intr for the last descriptor only */ + if (1==i) + flags = DDMA_FLAGS_IE; + else + flags = DDMA_FLAGS_NOIE; + + if (iswrite) { + if(!put_source_flags(ahwif->tx_chan, + (void*)(page_address(sg->page) + + sg->offset), + tc, flags)) { + printk(KERN_ERR "%s failed %d\n", + __FUNCTION__, __LINE__); } - } else + } else { - if(!put_dest_flags(ahwif->rx_chan, - (void*)(page_address(sg->page) - + sg->offset), - tc, flags)) { - printk(KERN_ERR "%s failed %d\n", - __FUNCTION__, __LINE__); + if(!put_dest_flags(ahwif->rx_chan, + (void*)(page_address(sg->page) + + sg->offset), + tc, flags)) { + printk(KERN_ERR "%s failed %d\n", + __FUNCTION__, __LINE__); } - } + } - cur_addr += tc; - cur_len -= tc; - } - sg++; - i--; - } + cur_addr += tc; + cur_len -= tc; + } + sg++; + i--; + } - if (count) - return 1; + if (count) + return 1; -use_pio_instead: - dma_unmap_sg(ahwif->dev, - hwif->sg_table, - hwif->sg_nents, - hwif->sg_dma_direction); + use_pio_instead: + dma_unmap_sg(ahwif->dev, + hwif->sg_table, + hwif->sg_nents, + hwif->sg_dma_direction); - return 0; /* revert to PIO for this request */ + return 0; /* revert to PIO for this request */ } static int auide_dma_end(ide_drive_t *drive) { - ide_hwif_t *hwif = HWIF(drive); - _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; + ide_hwif_t *hwif = HWIF(drive); + _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data; - if (hwif->sg_nents) { - dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents, - hwif->sg_dma_direction); - hwif->sg_nents = 0; - } + if (hwif->sg_nents) { + dma_unmap_sg(ahwif->dev, hwif->sg_table, hwif->sg_nents, + hwif->sg_dma_direction); + hwif->sg_nents = 0; + } - return 0; + return 0; } static void auide_dma_start(ide_drive_t *drive ) { -// printk("%s\n", __FUNCTION__); } -ide_startstop_t auide_dma_intr(ide_drive_t *drive) -{ - //printk("%s\n", __FUNCTION__); - - u8 stat = 0, dma_stat = 0; - - dma_stat = HWIF(drive)->ide_dma_end(drive); - stat = HWIF(drive)->INB(IDE_STATUS_REG); /* get drive status */ - if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) { - if (!dma_stat) { - struct request *rq = HWGROUP(drive)->rq; - - ide_end_request(drive, 1, rq->nr_sectors); - return ide_stopped; - } - printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n", - drive->name, dma_stat); - } - return ide_error(drive, "dma_intr", stat); -} static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) { - //printk("%s\n", __FUNCTION__); - - /* issue cmd to drive */ - ide_execute_command(drive, command, &auide_dma_intr, - (2*WAIT_CMD), NULL); + /* issue cmd to drive */ + ide_execute_command(drive, command, &ide_dma_intr, + (2*WAIT_CMD), NULL); } static int auide_dma_setup(ide_drive_t *drive) -{ -// printk("%s\n", __FUNCTION__); - - if (drive->media != ide_disk) - return 1; - - if (!auide_build_dmatable(drive)) - /* try PIO instead of DMA */ - return 1; +{ + struct request *rq = HWGROUP(drive)->rq; - drive->waiting_for_dma = 1; + if (!auide_build_dmatable(drive)) { + ide_map_sg(drive, rq); + return 1; + } - return 0; + drive->waiting_for_dma = 1; + return 0; } static int auide_dma_check(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); + u8 speed; #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - if( !dbdma_init_done ){ - auide_hwif.white_list = in_drive_list(drive->id, - dma_white_list); - auide_hwif.black_list = in_drive_list(drive->id, - dma_black_list); - auide_hwif.drive = drive; - auide_ddma_init(&auide_hwif); - dbdma_init_done = 1; - } + + if( dbdma_init_done == 0 ){ + auide_hwif.white_list = ide_in_drive_list(drive->id, + dma_white_list); + auide_hwif.black_list = ide_in_drive_list(drive->id, + dma_black_list); + auide_hwif.drive = drive; + auide_ddma_init(&auide_hwif); + dbdma_init_done = 1; + } #endif - /* Is the drive in our DMA black list? */ - if ( auide_hwif.black_list ) { - drive->using_dma = 0; - printk("%s found in dma_blacklist[]! Disabling DMA.\n", - drive->id->model); - } - else - drive->using_dma = 1; + /* Is the drive in our DMA black list? */ + + if ( auide_hwif.black_list ) { + drive->using_dma = 0; + + /* Borrowed the warning message from ide-dma.c */ - return HWIF(drive)->ide_dma_host_on(drive); + printk(KERN_WARNING "%s: Disabling DMA for %s (blacklisted)\n", + drive->name, drive->id->model); + } + else + drive->using_dma = 1; + + speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA); + + if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) + return HWIF(drive)->ide_dma_on(drive); + + return HWIF(drive)->ide_dma_off_quietly(drive); } static int auide_dma_test_irq(ide_drive_t *drive) -{ -// printk("%s\n", __FUNCTION__); - - if (!drive->waiting_for_dma) - printk(KERN_WARNING "%s: ide_dma_test_irq \ +{ + if (drive->waiting_for_dma == 0) + printk(KERN_WARNING "%s: ide_dma_test_irq \ called while not waiting\n", drive->name); - /* If dbdma didn't execute the STOP command yet, the - * active bit is still set + /* If dbdma didn't execute the STOP command yet, the + * active bit is still set */ - drive->waiting_for_dma++; - if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) { - printk(KERN_WARNING "%s: timeout waiting for ddma to \ + drive->waiting_for_dma++; + if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) { + printk(KERN_WARNING "%s: timeout waiting for ddma to \ complete\n", drive->name); - return 1; - } - udelay(10); - return 0; + return 1; + } + udelay(10); + return 0; } static int auide_dma_host_on(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); - return 0; + return 0; } static int auide_dma_on(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); - drive->using_dma = 1; - return auide_dma_host_on(drive); + drive->using_dma = 1; + return auide_dma_host_on(drive); } static int auide_dma_host_off(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); - return 0; + return 0; } static int auide_dma_off_quietly(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); - drive->using_dma = 0; - return auide_dma_host_off(drive); + drive->using_dma = 0; + return auide_dma_host_off(drive); } static int auide_dma_lostirq(ide_drive_t *drive) { -// printk("%s\n", __FUNCTION__); - - printk(KERN_ERR "%s: IRQ lost\n", drive->name); - return 0; + printk(KERN_ERR "%s: IRQ lost\n", drive->name); + return 0; } static void auide_ddma_tx_callback(int irq, void *param, struct pt_regs *regs) { -// printk("%s\n", __FUNCTION__); - - _auide_hwif *ahwif = (_auide_hwif*)param; - ahwif->drive->waiting_for_dma = 0; - return; + _auide_hwif *ahwif = (_auide_hwif*)param; + ahwif->drive->waiting_for_dma = 0; } static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs) { -// printk("%s\n", __FUNCTION__); + _auide_hwif *ahwif = (_auide_hwif*)param; + ahwif->drive->waiting_for_dma = 0; +} + +#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ - _auide_hwif *ahwif = (_auide_hwif*)param; - ahwif->drive->waiting_for_dma = 0; - return; +static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags) +{ + dev->dev_id = dev_id; + dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; + dev->dev_intlevel = 0; + dev->dev_intpolarity = 0; + dev->dev_tsize = tsize; + dev->dev_devwidth = devwidth; + dev->dev_flags = flags; } + +#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) static int auide_dma_timeout(ide_drive_t *drive) { // printk("%s\n", __FUNCTION__); - printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); + printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name); - if (HWIF(drive)->ide_dma_test_irq(drive)) - return 0; + if (HWIF(drive)->ide_dma_test_irq(drive)) + return 0; - return HWIF(drive)->ide_dma_end(drive); + return HWIF(drive)->ide_dma_end(drive); } -#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ + +static int auide_ddma_init(_auide_hwif *auide) { + + dbdev_tab_t source_dev_tab, target_dev_tab; + u32 dev_id, tsize, devwidth, flags; + ide_hwif_t *hwif = auide->hwif; -static int auide_ddma_init( _auide_hwif *auide ) -{ -// printk("%s\n", __FUNCTION__); + dev_id = AU1XXX_ATA_DDMA_REQ; - dbdev_tab_t source_dev_tab; -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) - dbdev_tab_t target_dev_tab; - ide_hwif_t *hwif = auide->hwif; - char warning_output [2][80]; - int i; -#endif + if (auide->white_list || auide->black_list) { + tsize = 8; + devwidth = 32; + } + else { + tsize = 1; + devwidth = 16; + + printk(KERN_ERR "au1xxx-ide: %s is not on ide driver whitelist.\n",auide_hwif.drive->id->model); + printk(KERN_ERR " please read 'Documentation/mips/AU1xxx_IDE.README'"); + } - /* Add our custom device to DDMA device table */ - /* Create our new device entries in the table */ -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) - source_dev_tab.dev_id = AU1XXX_ATA_DDMA_REQ; - - if( auide->white_list || auide->black_list ){ - source_dev_tab.dev_tsize = 8; - source_dev_tab.dev_devwidth = 32; - source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; - source_dev_tab.dev_intlevel = 0; - source_dev_tab.dev_intpolarity = 0; - - /* init device table for target - static bus controller - */ - target_dev_tab.dev_id = DSCR_CMD0_ALWAYS; - target_dev_tab.dev_tsize = 8; - target_dev_tab.dev_devwidth = 32; - target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; - target_dev_tab.dev_intlevel = 0; - target_dev_tab.dev_intpolarity = 0; - target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE; - } - else{ - source_dev_tab.dev_tsize = 1; - source_dev_tab.dev_devwidth = 16; - source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; - source_dev_tab.dev_intlevel = 0; - source_dev_tab.dev_intpolarity = 0; - - /* init device table for target - static bus controller - */ - target_dev_tab.dev_id = DSCR_CMD0_ALWAYS; - target_dev_tab.dev_tsize = 1; - target_dev_tab.dev_devwidth = 16; - target_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; - target_dev_tab.dev_intlevel = 0; - target_dev_tab.dev_intpolarity = 0; - target_dev_tab.dev_flags = DEV_FLAGS_ANYUSE; - - sprintf(&warning_output[0][0], - "%s is not on ide driver white list.", - auide_hwif.drive->id->model); - for ( i=strlen(&warning_output[0][0]) ; i<76; i++ ){ - sprintf(&warning_output[0][i]," "); - } - - sprintf(&warning_output[1][0], - "To add %s please read 'Documentation/mips/AU1xxx_IDE.README'.", - auide_hwif.drive->id->model); - for ( i=strlen(&warning_output[1][0]) ; i<76; i++ ){ - sprintf(&warning_output[1][i]," "); - } - - printk("\n****************************************"); - printk("****************************************\n"); - printk("* %s *\n",&warning_output[0][0]); - printk("* Switch to safe MWDMA Mode! "); - printk(" *\n"); - printk("* %s *\n",&warning_output[1][0]); - printk("****************************************"); - printk("****************************************\n\n"); - } +#ifdef IDE_AU1XXX_BURSTMODE + flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE; #else - source_dev_tab.dev_id = DSCR_CMD0_ALWAYS; - source_dev_tab.dev_tsize = 8; - source_dev_tab.dev_devwidth = 32; - source_dev_tab.dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; - source_dev_tab.dev_intlevel = 0; - source_dev_tab.dev_intpolarity = 0; + flags = DEV_FLAGS_SYNC; #endif -#if CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - /* set flags for tx channel */ - source_dev_tab.dev_flags = DEV_FLAGS_OUT - | DEV_FLAGS_SYNC - | DEV_FLAGS_BURSTABLE; - auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); - /* set flags for rx channel */ - source_dev_tab.dev_flags = DEV_FLAGS_IN - | DEV_FLAGS_SYNC - | DEV_FLAGS_BURSTABLE; - auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); + /* setup dev_tab for tx channel */ + auide_init_dbdma_dev( &source_dev_tab, + dev_id, + tsize, devwidth, DEV_FLAGS_OUT | flags); + auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); + + auide_init_dbdma_dev( &source_dev_tab, + dev_id, + tsize, devwidth, DEV_FLAGS_IN | flags); + auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); + + /* We also need to add a target device for the DMA */ + auide_init_dbdma_dev( &target_dev_tab, + (u32)DSCR_CMD0_ALWAYS, + tsize, devwidth, DEV_FLAGS_ANYUSE); + auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab); + + /* Get a channel for TX */ + auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id, + auide->tx_dev_id, + auide_ddma_tx_callback, + (void*)auide); + + /* Get a channel for RX */ + auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id, + auide->target_dev_id, + auide_ddma_rx_callback, + (void*)auide); + + auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan, + NUM_DESCRIPTORS); + auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan, + NUM_DESCRIPTORS); + + hwif->dmatable_cpu = dma_alloc_coherent(auide->dev, + PRD_ENTRIES * PRD_BYTES, /* 1 Page */ + &hwif->dmatable_dma, GFP_KERNEL); + + au1xxx_dbdma_start( auide->tx_chan ); + au1xxx_dbdma_start( auide->rx_chan ); + + return 0; +} #else - /* set flags for tx channel */ - source_dev_tab.dev_flags = DEV_FLAGS_OUT | DEV_FLAGS_SYNC; - auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); - /* set flags for rx channel */ - source_dev_tab.dev_flags = DEV_FLAGS_IN | DEV_FLAGS_SYNC; - auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); -#endif + +static int auide_ddma_init( _auide_hwif *auide ) +{ + dbdev_tab_t source_dev_tab; + int flags; -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) - - auide->target_dev_id = au1xxx_ddma_add_device(&target_dev_tab); - - /* Get a channel for TX */ - auide->tx_chan = au1xxx_dbdma_chan_alloc(auide->target_dev_id, - auide->tx_dev_id, - auide_ddma_tx_callback, - (void*)auide); - /* Get a channel for RX */ - auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id, - auide->target_dev_id, - auide_ddma_rx_callback, - (void*)auide); -#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */ - /* - * Note: if call back is not enabled, update ctp->cur_ptr manually - */ - auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS, - auide->tx_dev_id, - NULL, - (void*)auide); - auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id, - DSCR_CMD0_ALWAYS, - NULL, - (void*)auide); +#ifdef IDE_AU1XXX_BURSTMODE + flags = DEV_FLAGS_SYNC | DEV_FLAGS_BURSTABLE; +#else + flags = DEV_FLAGS_SYNC; #endif - auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan, - NUM_DESCRIPTORS); - auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan, - NUM_DESCRIPTORS); -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) - hwif->dmatable_cpu = dma_alloc_coherent(auide->dev, - PRD_ENTRIES * PRD_BYTES, /* 1 Page */ - &hwif->dmatable_dma, GFP_KERNEL); - - auide->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, - GFP_KERNEL|GFP_DMA); - if (auide->sg_table == NULL) { - return -ENOMEM; - } -#endif - au1xxx_dbdma_start( auide->tx_chan ); - au1xxx_dbdma_start( auide->rx_chan ); - return 0; + /* setup dev_tab for tx channel */ + auide_init_dbdma_dev( &source_dev_tab, + (u32)DSCR_CMD0_ALWAYS, + 8, 32, DEV_FLAGS_OUT | flags); + auide->tx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); + + auide_init_dbdma_dev( &source_dev_tab, + (u32)DSCR_CMD0_ALWAYS, + 8, 32, DEV_FLAGS_IN | flags); + auide->rx_dev_id = au1xxx_ddma_add_device( &source_dev_tab ); + + /* Get a channel for TX */ + auide->tx_chan = au1xxx_dbdma_chan_alloc(DSCR_CMD0_ALWAYS, + auide->tx_dev_id, + NULL, + (void*)auide); + + /* Get a channel for RX */ + auide->rx_chan = au1xxx_dbdma_chan_alloc(auide->rx_dev_id, + DSCR_CMD0_ALWAYS, + NULL, + (void*)auide); + + auide->tx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->tx_chan, + NUM_DESCRIPTORS); + auide->rx_desc_head = (void*)au1xxx_dbdma_ring_alloc(auide->rx_chan, + NUM_DESCRIPTORS); + + au1xxx_dbdma_start( auide->tx_chan ); + au1xxx_dbdma_start( auide->rx_chan ); + + return 0; } +#endif static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) { - int i; -#define ide_ioreg_t unsigned long - ide_ioreg_t *ata_regs = hw->io_ports; - - /* fixme */ - for (i = 0; i < IDE_CONTROL_OFFSET; i++) { - *ata_regs++ = (ide_ioreg_t) ahwif->regbase - + (ide_ioreg_t)(i << AU1XXX_ATA_REG_OFFSET); - } - - /* set the Alternative Status register */ - *ata_regs = (ide_ioreg_t) ahwif->regbase - + (ide_ioreg_t)(14 << AU1XXX_ATA_REG_OFFSET); + int i; + unsigned long *ata_regs = hw->io_ports; + + /* FIXME? */ + for (i = 0; i < IDE_CONTROL_OFFSET; i++) { + *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET); + } + + /* set the Alternative Status register */ + *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); } static int au_ide_probe(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); - _auide_hwif *ahwif = &auide_hwif; - ide_hwif_t *hwif; + _auide_hwif *ahwif = &auide_hwif; + ide_hwif_t *hwif; struct resource *res; int ret = 0; #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) - char *mode = "MWDMA2"; + char *mode = "MWDMA2"; #elif defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) - char *mode = "PIO+DDMA(offload)"; + char *mode = "PIO+DDMA(offload)"; #endif - memset(&auide_hwif, 0, sizeof(_auide_hwif)); - auide_hwif.dev = 0; + memset(&auide_hwif, 0, sizeof(_auide_hwif)); + auide_hwif.dev = 0; ahwif->dev = dev; ahwif->irq = platform_get_irq(pdev, 0); @@ -902,11 +675,11 @@ static int au_ide_probe(struct device *dev) goto out; } - if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { + if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { pr_debug("%s: request_mem_region failed\n", DRV_NAME); - ret = -EBUSY; + ret = -EBUSY; goto out; - } + } ahwif->regbase = (u32)ioremap(res->start, res->end-res->start); if (ahwif->regbase == 0) { @@ -914,130 +687,92 @@ static int au_ide_probe(struct device *dev) goto out; } - hwif = &ide_hwifs[pdev->id]; + /* FIXME: This might possibly break PCMCIA IDE devices */ + + hwif = &ide_hwifs[pdev->id]; hw_regs_t *hw = &hwif->hw; - hwif->irq = hw->irq = ahwif->irq; - hwif->chipset = ide_au1xxx; + hwif->irq = hw->irq = ahwif->irq; + hwif->chipset = ide_au1xxx; - auide_setup_ports(hw, ahwif); + auide_setup_ports(hw, ahwif); memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - hwif->rqsize = CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ; - hwif->rqsize = ((hwif->rqsize > AU1XXX_ATA_RQSIZE) - || (hwif->rqsize < 32)) ? AU1XXX_ATA_RQSIZE : hwif->rqsize; -#else /* if kernel config is not set */ - hwif->rqsize = AU1XXX_ATA_RQSIZE; -#endif - - hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ + hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */ - hwif->swdma_mask = 0x07; + hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */ + hwif->swdma_mask = 0x00; #else - hwif->mwdma_mask = 0x0; - hwif->swdma_mask = 0x0; + hwif->mwdma_mask = 0x0; + hwif->swdma_mask = 0x0; +#endif + + hwif->noprobe = 0; + hwif->drives[0].unmask = 1; + hwif->drives[1].unmask = 1; + + /* hold should be on in all cases */ + hwif->hold = 1; + hwif->mmio = 2; + + /* If the user has selected DDMA assisted copies, + then set up a few local I/O function entry points + */ + +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA + hwif->INSW = auide_insw; + hwif->OUTSW = auide_outsw; #endif - //hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; - hwif->noprobe = 0; - hwif->drives[0].unmask = 1; - hwif->drives[1].unmask = 1; - - /* hold should be on in all cases */ - hwif->hold = 1; - hwif->mmio = 2; - - /* set up local I/O function entry points */ - hwif->INB = auide_inb; - hwif->INW = auide_inw; - hwif->INL = auide_inl; - hwif->INSW = auide_insw; - hwif->INSL = auide_insl; - hwif->OUTB = auide_outb; - hwif->OUTBSYNC = auide_outbsync; - hwif->OUTW = auide_outw; - hwif->OUTL = auide_outl; - hwif->OUTSW = auide_outsw; - hwif->OUTSL = auide_outsl; - - hwif->tuneproc = &auide_tune_drive; - hwif->speedproc = &auide_tune_chipset; + + hwif->tuneproc = &auide_tune_drive; + hwif->speedproc = &auide_tune_chipset; #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - hwif->ide_dma_off_quietly = &auide_dma_off_quietly; - hwif->ide_dma_timeout = &auide_dma_timeout; - - hwif->ide_dma_check = &auide_dma_check; - hwif->dma_exec_cmd = &auide_dma_exec_cmd; - hwif->dma_start = &auide_dma_start; - hwif->ide_dma_end = &auide_dma_end; - hwif->dma_setup = &auide_dma_setup; - hwif->ide_dma_test_irq = &auide_dma_test_irq; - hwif->ide_dma_host_off = &auide_dma_host_off; - hwif->ide_dma_host_on = &auide_dma_host_on; - hwif->ide_dma_lostirq = &auide_dma_lostirq; - hwif->ide_dma_on = &auide_dma_on; - - hwif->autodma = 1; - hwif->drives[0].autodma = hwif->autodma; - hwif->drives[1].autodma = hwif->autodma; - hwif->atapi_dma = 1; - hwif->drives[0].using_dma = 1; - hwif->drives[1].using_dma = 1; + hwif->ide_dma_off_quietly = &auide_dma_off_quietly; + hwif->ide_dma_timeout = &auide_dma_timeout; + + hwif->ide_dma_check = &auide_dma_check; + hwif->dma_exec_cmd = &auide_dma_exec_cmd; + hwif->dma_start = &auide_dma_start; + hwif->ide_dma_end = &auide_dma_end; + hwif->dma_setup = &auide_dma_setup; + hwif->ide_dma_test_irq = &auide_dma_test_irq; + hwif->ide_dma_host_off = &auide_dma_host_off; + hwif->ide_dma_host_on = &auide_dma_host_on; + hwif->ide_dma_lostirq = &auide_dma_lostirq; + hwif->ide_dma_on = &auide_dma_on; + + hwif->autodma = 1; + hwif->drives[0].autodma = hwif->autodma; + hwif->drives[1].autodma = hwif->autodma; + hwif->atapi_dma = 1; + #else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ - hwif->autodma = 0; - hwif->channel = 0; - hwif->hold = 1; - hwif->select_data = 0; /* no chipset-specific code */ - hwif->config_data = 0; /* no chipset-specific code */ - - hwif->drives[0].autodma = 0; - hwif->drives[0].drive_data = 0; /* no drive data */ - hwif->drives[0].using_dma = 0; - hwif->drives[0].waiting_for_dma = 0; - hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ - /* secondary hdd not supported */ - hwif->drives[1].autodma = 0; - - hwif->drives[1].drive_data = 0; - hwif->drives[1].using_dma = 0; - hwif->drives[1].waiting_for_dma = 0; - hwif->drives[1].autotune = 2; /* 1=autotune, 2=noautotune, 0=default */ -#endif - hwif->drives[0].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ - hwif->drives[1].io_32bit = 0; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ - - /*Register Driver with PM Framework*/ -#ifdef CONFIG_PM - auide_hwif.pm.lock = SPIN_LOCK_UNLOCKED; - auide_hwif.pm.stopped = 0; - - auide_hwif.pm.dev = new_au1xxx_power_device( "ide", - &au1200ide_pm_callback, - NULL); - if ( auide_hwif.pm.dev == NULL ) - printk(KERN_INFO "Unable to create a power management \ - device entry for the au1200-IDE.\n"); - else - printk(KERN_INFO "Power management device entry for the \ - au1200-IDE loaded.\n"); + hwif->autodma = 0; + hwif->channel = 0; + hwif->hold = 1; + hwif->select_data = 0; /* no chipset-specific code */ + hwif->config_data = 0; /* no chipset-specific code */ + + hwif->drives[0].autodma = 0; + hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ #endif + hwif->drives[0].no_io_32bit = 1; - auide_hwif.hwif = hwif; - hwif->hwif_data = &auide_hwif; + auide_hwif.hwif = hwif; + hwif->hwif_data = &auide_hwif; -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - auide_ddma_init(&auide_hwif); - dbdma_init_done = 1; +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA + auide_ddma_init(&auide_hwif); + dbdma_init_done = 1; #endif probe_hwif_init(hwif); dev_set_drvdata(dev, hwif); - printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); + printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); -out: - return ret; + out: + return ret; } static int au_ide_remove(struct device *dev) @@ -1045,7 +780,7 @@ static int au_ide_remove(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct resource *res; ide_hwif_t *hwif = dev_get_drvdata(dev); - _auide_hwif *ahwif = &auide_hwif; + _auide_hwif *ahwif = &auide_hwif; ide_unregister(hwif - ide_hwifs); @@ -1069,180 +804,11 @@ static int __init au_ide_init(void) return driver_register(&au1200_ide_driver); } -static void __init au_ide_exit(void) +static void __exit au_ide_exit(void) { driver_unregister(&au1200_ide_driver); } -#ifdef CONFIG_PM -int au1200ide_pm_callback( au1xxx_power_dev_t *dev,\ - au1xxx_request_t request, void *data) { - - unsigned int d, err = 0; - unsigned long flags; - - spin_lock_irqsave(auide_hwif.pm.lock, flags); - - switch (request){ - case AU1XXX_PM_SLEEP: - err = au1xxxide_pm_sleep(dev); - break; - case AU1XXX_PM_WAKEUP: - d = *((unsigned int*)data); - if ( d > 0 && d <= 99) { - err = au1xxxide_pm_standby(dev); - } - else { - err = au1xxxide_pm_resume(dev); - } - break; - case AU1XXX_PM_GETSTATUS: - err = au1xxxide_pm_getstatus(dev); - break; - case AU1XXX_PM_ACCESS: - err = au1xxxide_pm_access(dev); - break; - case AU1XXX_PM_IDLE: - err = au1xxxide_pm_idle(dev); - break; - case AU1XXX_PM_CLEANUP: - err = au1xxxide_pm_cleanup(dev); - break; - default: - err = -1; - break; - } - - spin_unlock_irqrestore(auide_hwif.pm.lock, flags); - - return err; -} - -static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev ) { - return 0; -} - -static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev ) { - - int retval; - ide_hwif_t *hwif = auide_hwif.hwif; - struct request rq; - struct request_pm_state rqpm; - ide_task_t args; - - if(auide_hwif.pm.stopped) - return -1; - - /* - * wait until hard disc is ready - */ - if ( wait_for_ready(&hwif->drives[0], 35000) ) { - printk("Wait for drive sleep timeout!\n"); - retval = -1; - } - - /* - * sequenz to tell the high level ide driver that pm is resuming - */ - memset(&rq, 0, sizeof(rq)); - memset(&rqpm, 0, sizeof(rqpm)); - memset(&args, 0, sizeof(args)); - rq.flags = REQ_PM_SUSPEND; - rq.special = &args; - rq.pm = &rqpm; - rqpm.pm_step = ide_pm_state_start_suspend; - rqpm.pm_state = PMSG_SUSPEND; - - retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_wait); - - if (wait_for_ready (&hwif->drives[0], 35000)) { - printk("Wait for drive sleep timeout!\n"); - retval = -1; - } - - /* - * stop dbdma channels - */ - au1xxx_dbdma_reset(auide_hwif.tx_chan); - au1xxx_dbdma_reset(auide_hwif.rx_chan); - - auide_hwif.pm.stopped = 1; - - return retval; -} - -static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev ) { - - int retval; - ide_hwif_t *hwif = auide_hwif.hwif; - struct request rq; - struct request_pm_state rqpm; - ide_task_t args; - - if(!auide_hwif.pm.stopped) - return -1; - - /* - * start dbdma channels - */ - au1xxx_dbdma_start(auide_hwif.tx_chan); - au1xxx_dbdma_start(auide_hwif.rx_chan); - - /* - * wait until hard disc is ready - */ - if (wait_for_ready ( &hwif->drives[0], 35000)) { - printk("Wait for drive wake up timeout!\n"); - retval = -1; - } - - /* - * sequenz to tell the high level ide driver that pm is resuming - */ - memset(&rq, 0, sizeof(rq)); - memset(&rqpm, 0, sizeof(rqpm)); - memset(&args, 0, sizeof(args)); - rq.flags = REQ_PM_RESUME; - rq.special = &args; - rq.pm = &rqpm; - rqpm.pm_step = ide_pm_state_start_resume; - rqpm.pm_state = PMSG_ON; - - retval = ide_do_drive_cmd(&hwif->drives[0], &rq, ide_head_wait); - - /* - * wait for hard disc - */ - if ( wait_for_ready(&hwif->drives[0], 35000) ) { - printk("Wait for drive wake up timeout!\n"); - retval = -1; - } - - auide_hwif.pm.stopped = 0; - - return retval; -} - -static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev ) { - return dev->cur_state; -} - -static int au1xxxide_pm_access( au1xxx_power_dev_t *dev ) { - if (dev->cur_state != AWAKE_STATE) - return 0; - else - return -1; -} - -static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev ) { - return 0; -} - -static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev ) { - return 0; -} -#endif /* CONFIG_PM */ - MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("AU1200 IDE driver"); diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h index 0c3c127e619..e867b4ef96d 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_ide.h +++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h @@ -74,9 +74,6 @@ typedef struct u8 white_list, black_list; struct dbdma_cmd *dma_table_cpu; dma_addr_t dma_table_dma; - struct scatterlist *sg_table; - int sg_nents; - int sg_dma_direction; #endif struct device *dev; int irq; @@ -162,13 +159,9 @@ int __init auide_probe(void); * Multi-Word DMA + DbDMA functions */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - - static int in_drive_list(struct hd_driveid *id, - const struct drive_list_entry *drive_table); static int auide_build_sglist(ide_drive_t *drive, struct request *rq); static int auide_build_dmatable(ide_drive_t *drive); static int auide_dma_end(ide_drive_t *drive); - static void auide_dma_start(ide_drive_t *drive ); ide_startstop_t auide_dma_intr (ide_drive_t *drive); static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command); static int auide_dma_setup(ide_drive_t *drive); @@ -183,8 +176,6 @@ int __init auide_probe(void); static void auide_ddma_rx_callback(int irq, void *param, struct pt_regs *regs); static int auide_dma_off_quietly(ide_drive_t *drive); - static int auide_dma_timeout(ide_drive_t *drive); - #endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ /******************************************************************************* @@ -294,3 +285,11 @@ int __init auide_probe(void); #define SBC_IDE_MDMA2_TPM (0x00<<6) #define SBC_IDE_MDMA2_TA (0x12<<0) +#define SBC_IDE_TIMING(mode) \ + SBC_IDE_##mode##_TWCS | \ + SBC_IDE_##mode##_TCSH | \ + SBC_IDE_##mode##_TCSOFF | \ + SBC_IDE_##mode##_TWP | \ + SBC_IDE_##mode##_TCSW | \ + SBC_IDE_##mode##_TPM | \ + SBC_IDE_##mode##_TA -- cgit v1.2.3 From d36fef6f5aa4a6a1f44490455393a5b22137a6cd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Thu, 15 Dec 2005 02:19:20 +0100 Subject: [PATCH] ide-disk: flush cache after calling del_gendisk() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index f4e3d3527b0..449522f0540 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1034,12 +1034,12 @@ static int ide_disk_remove(struct device *dev) struct ide_disk_obj *idkp = drive->driver_data; struct gendisk *g = idkp->disk; - ide_cacheflush_p(drive); - ide_unregister_subdriver(drive, idkp->driver); del_gendisk(g); + ide_cacheflush_p(drive); + ide_disk_put(idkp); return 0; -- cgit v1.2.3 From 517bd1d5eac739a7f398058a9524386667fff032 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Thu, 15 Dec 2005 02:19:57 +0100 Subject: [PATCH] ide: cleanup ide.h Remove: * stale comment * unused HOST() macro * unused ata_{error,control}_t types * unused atapi_select_t type * ide_init_subdrivers() prototype Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 122 ---------------------------------------------------- 1 file changed, 122 deletions(-) diff --git a/include/linux/ide.h b/include/linux/ide.h index a6b28dcf8f0..613534b7705 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -23,17 +23,6 @@ #include #include -/* - * This is the multiple IDE interface driver, as evolved from hd.c. - * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15). - * There can be up to two drives per interface, as per the ATA-2 spec. - * - * Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64 - * Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64 - * Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64 - * Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64 - */ - /****************************************************************************** * IDE driver configuration options (play with these as desired): * @@ -193,11 +182,6 @@ typedef unsigned char byte; /* used everywhere */ #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ -#define HOST(hwif,chipset) \ -{ \ - return ((hwif)->chipset == chipset) ? 1 : 0; \ -} - /* * Check for an interrupt and acknowledge the interrupt status */ @@ -390,45 +374,6 @@ typedef union { } b; } ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; -/* - * ATA-IDE Error Register - * - * mark : Bad address mark - * tzero : Couldn't find track 0 - * abrt : Aborted Command - * mcr : Media Change Request - * id : ID field not found - * mce : Media Change Event - * ecc : Uncorrectable ECC error - * bdd : dual meaing - */ -typedef union { - unsigned all :8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned mark :1; - unsigned tzero :1; - unsigned abrt :1; - unsigned mcr :1; - unsigned id :1; - unsigned mce :1; - unsigned ecc :1; - unsigned bdd :1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned bdd :1; - unsigned ecc :1; - unsigned mce :1; - unsigned id :1; - unsigned mcr :1; - unsigned abrt :1; - unsigned tzero :1; - unsigned mark :1; -#else -#error "Please fix " -#endif - } b; -} ata_error_t; - /* * ATA-IDE Select Register, aka Device-Head * @@ -503,39 +448,6 @@ typedef union { } b; } ata_status_t, atapi_status_t; -/* - * ATA-IDE Control Register - * - * bit0 : Should be set to zero - * nIEN : device INTRQ to host - * SRST : host soft reset bit - * bit3 : ATA-2 thingy, Should be set to 1 - * reserved456 : Reserved - * HOB : 48-bit address ordering, High Ordered Bit - */ -typedef union { - unsigned all : 8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned bit0 : 1; - unsigned nIEN : 1; - unsigned SRST : 1; - unsigned bit3 : 1; - unsigned reserved456 : 3; - unsigned HOB : 1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned HOB : 1; - unsigned reserved456 : 3; - unsigned bit3 : 1; - unsigned SRST : 1; - unsigned nIEN : 1; - unsigned bit0 : 1; -#else -#error "Please fix " -#endif - } b; -} ata_control_t; - /* * ATAPI Feature Register * @@ -617,39 +529,6 @@ typedef union { } b; } atapi_error_t; -/* - * ATAPI floppy Drive Select Register - * - * sam_lun : Logical unit number - * reserved3 : Reserved - * drv : The responding drive will be drive 0 (0) or drive 1 (1) - * one5 : Should be set to 1 - * reserved6 : Reserved - * one7 : Should be set to 1 - */ -typedef union { - unsigned all :8; - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned sam_lun :3; - unsigned reserved3 :1; - unsigned drv :1; - unsigned one5 :1; - unsigned reserved6 :1; - unsigned one7 :1; -#elif defined(__BIG_ENDIAN_BITFIELD) - unsigned one7 :1; - unsigned reserved6 :1; - unsigned one5 :1; - unsigned drv :1; - unsigned reserved3 :1; - unsigned sam_lun :3; -#else -#error "Please fix " -#endif - } b; -} atapi_select_t; - /* * Status returned from various ide_ functions */ @@ -1298,7 +1177,6 @@ extern int ide_spin_wait_hwgroup(ide_drive_t *); extern void ide_timer_expiry(unsigned long); extern irqreturn_t ide_intr(int irq, void *dev_id, struct pt_regs *regs); extern void do_ide_request(request_queue_t *); -extern void ide_init_subdrivers(void); void ide_init_disk(struct gendisk *, ide_drive_t *); -- cgit v1.2.3 From 7b4df9ece9b4c4a754bd1f5603cdabff26b987e5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Thu, 15 Dec 2005 02:20:15 +0100 Subject: [PATCH] ide: cleanup ide_driver_t Remove unused fields: ioctl, ata[pi]_prebuilder. Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/ide.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/ide.h b/include/linux/ide.h index 613534b7705..7b6a6a58e46 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -980,10 +980,7 @@ typedef struct ide_driver_s { int (*end_request)(ide_drive_t *, int, int); ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); - int (*ioctl)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); ide_proc_entry_t *proc; - void (*ata_prebuilder)(ide_drive_t *); - void (*atapi_prebuilder)(ide_drive_t *); struct device_driver gen_driver; } ide_driver_t; -- cgit v1.2.3 From 0afaa4fc4abc773ce129f41009a50eeecf3aa50c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Thu, 15 Dec 2005 02:20:49 +0100 Subject: [PATCH] ide-cd: remove write-only cmd field from struct cdrom_info Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 7 ------- drivers/ide/ide-cd.h | 1 - 2 files changed, 8 deletions(-) diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 9455e42abb2..b4d7a3efb90 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1292,7 +1292,6 @@ static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block) struct cdrom_info *info = drive->driver_data; info->dma = 0; - info->cmd = 0; info->start_seek = jiffies; return cdrom_start_packet_command(drive, 0, cdrom_start_seek_continuation); } @@ -1344,8 +1343,6 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block) (rq->nr_sectors & (sectors_per_frame - 1))) info->dma = 0; - info->cmd = READ; - /* Start sending the read request to the drive. */ return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation); } @@ -1484,7 +1481,6 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive) struct cdrom_info *info = drive->driver_data; info->dma = 0; - info->cmd = 0; rq->flags &= ~REQ_FAILED; len = rq->data_len; @@ -1891,7 +1887,6 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq) /* use dma, if possible. we don't need to check more, since we * know that the transfer is always (at least!) frame aligned */ info->dma = drive->using_dma ? 1 : 0; - info->cmd = WRITE; info->devinfo.media_written = 1; @@ -1916,7 +1911,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) rq->flags |= REQ_QUIET; info->dma = 0; - info->cmd = 0; /* * sg request @@ -1925,7 +1919,6 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) int mask = drive->queue->dma_alignment; unsigned long addr = (unsigned long) page_address(bio_page(rq->bio)); - info->cmd = rq_data_dir(rq); info->dma = drive->using_dma; /* diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 7ca3e5afc66..ad1f2ed14a3 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -480,7 +480,6 @@ struct cdrom_info { struct request request_sense_request; int dma; - int cmd; unsigned long last_block; unsigned long start_seek; /* Buffer to hold mechanism status and changer slot table. */ -- cgit v1.2.3 From c45b4f1f1e149c023762ac4be166ead1818cefef Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 14 Dec 2005 18:52:21 -0800 Subject: Move size optimization option outside of EMBEDDED menu, mark it EXPERIMENTAL Also, disable on sparc64 - a number of people report breakage. Probably a compiler bug, but it's quite possible that it tickles some latent kernel problem too. It still defaults to 'y' everywhere else (when enabled through EXPERIMENTAL), and Dave Jones points out that Fedora (and RHEL4) has been building with size optimizations for a long time on x86, x86-64, ia64, s390, s390x, ppc32 and ppc64. So it is really only moderately experimental, but the sparc64 breakage certainly shows that it can trigger "issues". Signed-off-by: Linus Torvalds --- init/Kconfig | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index be74adb389e..6c5dbedc6e9 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -256,6 +256,20 @@ config CPUSETS source "usr/Kconfig" +config CC_OPTIMIZE_FOR_SIZE + bool "Optimize for size (Look out for broken compilers!)" + default y + depends on ARM || H8300 || EXPERIMENTAL + depends on !SPARC64 + help + Enabling this option will pass "-Os" instead of "-O2" to gcc + resulting in a smaller kernel. + + WARNING: some versions of gcc may generate incorrect code with this + option. If problems are observed, a gcc upgrade may be needed. + + If unsure, say N. + menuconfig EMBEDDED bool "Configure standard kernel features (for small systems)" help @@ -338,18 +352,6 @@ config EPOLL Disabling this option will cause the kernel to be built without support for epoll family of system calls. -config CC_OPTIMIZE_FOR_SIZE - bool "Optimize for size" - default y if ARM || H8300 - help - Enabling this option will pass "-Os" instead of "-O2" to gcc - resulting in a smaller kernel. - - WARNING: some versions of gcc may generate incorrect code with this - option. If problems are observed, a gcc upgrade may be needed. - - If unsure, say N. - config SHMEM bool "Use full shmem filesystem" if EMBEDDED default y -- cgit v1.2.3 From ea54c96c04cfd9fec881e403d8f7931b47f7b2a6 Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Wed, 14 Dec 2005 21:47:00 -0500 Subject: [PATCH] Input: ALPS - correctly report button presses on Fujitsu Siemens S6010 Without this patch Forward and Backward buttons on the touchpad do not generate any events. Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/input/mouse/alps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 4acc7fd4cd0..4f41ec3e433 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -42,7 +42,7 @@ static struct alps_model_info alps_model_data[] = { { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, { { 0x63, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, { { 0x63, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, - { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, 0 }, + { { 0x63, 0x02, 0x28 }, 0xf8, 0xf8, ALPS_FW_BK_2 }, /* Fujitsu Siemens S6010 */ { { 0x63, 0x02, 0x3c }, 0x8f, 0x8f, ALPS_WHEEL }, /* Toshiba Satellite S2400-103 */ { { 0x63, 0x02, 0x50 }, 0xef, 0xef, ALPS_FW_BK_1 }, /* NEC Versa L320 */ { { 0x63, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, -- cgit v1.2.3 From 5d5e815618c4a8b53806845268c951201d14af6e Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 14 Dec 2005 14:38:36 -0500 Subject: [PATCH] reiserfs: skip commit on io error This should have been part of the original io error patch, but got dropped somewhere along the way. It's extremely important when handling the i/o error in the journal to not commit the transaction with corrupt data. This patch adds that code back in. Signed-off-by: Jeff Mahoney Signed-off-by: Linus Torvalds --- fs/reiserfs/journal.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 68b7b78638f..3f17ef844fb 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -1039,6 +1039,10 @@ static int flush_commit_list(struct super_block *s, } atomic_dec(&journal->j_async_throttle); + /* We're skipping the commit if there's an error */ + if (retval || reiserfs_is_journal_aborted(journal)) + barrier = 0; + /* wait on everything written so far before writing the commit * if we are in barrier mode, send the commit down now */ @@ -1077,10 +1081,16 @@ static int flush_commit_list(struct super_block *s, BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); if (!barrier) { - if (buffer_dirty(jl->j_commit_bh)) - BUG(); - mark_buffer_dirty(jl->j_commit_bh); - sync_dirty_buffer(jl->j_commit_bh); + /* If there was a write error in the journal - we can't commit + * this transaction - it will be invalid and, if successful, + * will just end up propogating the write error out to + * the file system. */ + if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { + if (buffer_dirty(jl->j_commit_bh)) + BUG(); + mark_buffer_dirty(jl->j_commit_bh) ; + sync_dirty_buffer(jl->j_commit_bh) ; + } } else wait_on_buffer(jl->j_commit_bh); -- cgit v1.2.3 From 2499604960fff307fe99ff4d4363c50eaa69235a Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 14 Dec 2005 14:38:05 -0500 Subject: [PATCH] reiserfs: close open transactions on error path The following patch fixes a bug where if the journal is aborted, it can leave a transaction open. The result will be a BUG when another code path attempts to start a transaction and will get a "nesting into different fs" error, since current->journal_info will be left non-NULL. Original fix against SUSE kernel by Chris Mason Signed-off-by: Jeff Mahoney Signed-off-by: Linus Torvalds --- fs/reiserfs/inode.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 0a044ad9888..a5e3a0ddbe5 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -32,6 +32,7 @@ void reiserfs_delete_inode(struct inode *inode) JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); struct reiserfs_transaction_handle th; + int err; truncate_inode_pages(&inode->i_data, 0); @@ -49,15 +50,13 @@ void reiserfs_delete_inode(struct inode *inode) } reiserfs_update_inode_transaction(inode); - if (reiserfs_delete_object(&th, inode)) { - up(&inode->i_sem); - goto out; - } + err = reiserfs_delete_object(&th, inode); /* Do quota update inside a transaction for journaled quotas. We must do that * after delete_object so that quota updates go into the same transaction as * stat data deletion */ - DQUOT_FREE_INODE(inode); + if (!err) + DQUOT_FREE_INODE(inode); if (journal_end(&th, inode->i_sb, jbegin_count)) { up(&inode->i_sem); @@ -66,6 +65,12 @@ void reiserfs_delete_inode(struct inode *inode) up(&inode->i_sem); + /* check return value from reiserfs_delete_object after + * ending the transaction + */ + if (err) + goto out; + /* all items of file are deleted, so we can remove "save" link */ remove_save_link(inode, 0 /* not truncate */ ); /* we can't do anything * about an error here */ @@ -2099,6 +2104,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) struct page *page = NULL; int error; struct buffer_head *bh = NULL; + int err2; reiserfs_write_lock(p_s_inode->i_sb); @@ -2136,14 +2142,18 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps) transaction of truncating gets committed - on reboot the file either appears truncated properly or not truncated at all */ add_save_link(&th, p_s_inode, 1); - error = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); - if (error) - goto out; + err2 = reiserfs_do_truncate(&th, p_s_inode, page, update_timestamps); error = journal_end(&th, p_s_inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1); if (error) goto out; + /* check reiserfs_do_truncate after ending the transaction */ + if (err2) { + error = err2; + goto out; + } + if (update_timestamps) { error = remove_save_link(p_s_inode, 1 /* truncate */ ); if (error) -- cgit v1.2.3 From f8ad23a401d41f90cb377035d206b41de0699a0b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:44:18 -0500 Subject: [PATCH] fix iomem annotations in sparc32 pcic code Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/pcic.c | 2 +- include/asm-sparc/pcic.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index cccfc12802e..42002b742de 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c @@ -161,7 +161,7 @@ static struct pcic_sn2list pcic_known_sysnames[] = { static int pcic0_up; static struct linux_pcic pcic0; -void * __iomem pcic_regs; +void __iomem *pcic_regs; volatile int pcic_speculative; volatile int pcic_trapped; diff --git a/include/asm-sparc/pcic.h b/include/asm-sparc/pcic.h index 301ae8022dd..dedea14d87c 100644 --- a/include/asm-sparc/pcic.h +++ b/include/asm-sparc/pcic.h @@ -16,10 +16,10 @@ #include struct linux_pcic { - void * __iomem pcic_regs; + void __iomem *pcic_regs; unsigned long pcic_io; - void * __iomem pcic_config_space_addr; - void * __iomem pcic_config_space_data; + void __iomem *pcic_config_space_addr; + void __iomem *pcic_config_space_data; struct resource pcic_res_regs; struct resource pcic_res_io; struct resource pcic_res_cfg_addr; -- cgit v1.2.3 From b7c690b52f424574f7ac8c607e71e9f5c283a557 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:50:56 -0500 Subject: [PATCH] sparc: vfc __iomem annotations and fixes Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/sbus/char/vfc.h | 2 +- drivers/sbus/char/vfc_dev.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h index a7782e7da42..8045cd5e7cb 100644 --- a/drivers/sbus/char/vfc.h +++ b/drivers/sbus/char/vfc.h @@ -125,7 +125,7 @@ struct vfc_regs { struct vfc_dev { - volatile struct vfc_regs *regs; + volatile struct vfc_regs __iomem *regs; struct vfc_regs *phys_regs; unsigned int control_reg; struct semaphore device_lock_sem; diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 7a103698fa3..dfdd6be551f 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -149,7 +149,7 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) } printk("Initializing vfc%d\n",instance); dev->regs = NULL; - dev->regs = (volatile struct vfc_regs *) + dev->regs = (volatile struct vfc_regs __iomem *) sbus_ioremap(&sdev->resource[0], 0, sizeof(struct vfc_regs), vfcstr); dev->which_io = sdev->reg_addrs[0].which_io; @@ -319,7 +319,7 @@ int vfc_capture_poll(struct vfc_dev *dev) int timeout = 1000; while (!timeout--) { - if (dev->regs->control & VFC_STATUS_CAPTURE) + if (sbus_readl(&dev->regs->control) & VFC_STATUS_CAPTURE) break; vfc_i2c_delay_no_busy(dev, 100); } @@ -718,7 +718,7 @@ static void deinit_vfc_device(struct vfc_dev *dev) if(dev == NULL) return; devfs_remove("vfc/%d", dev->instance); - sbus_iounmap((unsigned long)dev->regs, sizeof(struct vfc_regs)); + sbus_iounmap(dev->regs, sizeof(struct vfc_regs)); kfree(dev); } -- cgit v1.2.3 From bc05d83bbf20a32eb24624726d1027aa960a573c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:51:43 -0500 Subject: [PATCH] sparc: jsflash __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/sbus/char/jsflash.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index c12c5046e2f..14631ac11bc 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c @@ -249,11 +249,11 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig) /* * OS SIMM Cannot be read in other size but a 32bits word. */ -static ssize_t jsf_read(struct file * file, char * buf, +static ssize_t jsf_read(struct file * file, char __user * buf, size_t togo, loff_t *ppos) { unsigned long p = *ppos; - char *tmp = buf; + char __user *tmp = buf; union byte4 { char s[4]; @@ -305,7 +305,7 @@ static ssize_t jsf_read(struct file * file, char * buf, return tmp-buf; } -static ssize_t jsf_write(struct file * file, const char * buf, +static ssize_t jsf_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { return -ENOSPC; @@ -356,10 +356,10 @@ static int jsf_ioctl_erase(unsigned long arg) * Program a block of flash. * Very simple because we can do it byte by byte anyway. */ -static int jsf_ioctl_program(unsigned long arg) +static int jsf_ioctl_program(void __user *arg) { struct jsflash_program_arg abuf; - char *uptr; + char __user *uptr; unsigned long p; unsigned int togo; union { @@ -367,13 +367,13 @@ static int jsf_ioctl_program(unsigned long arg) char s[4]; } b; - if (copy_from_user(&abuf, (char *)arg, JSFPRGSZ)) + if (copy_from_user(&abuf, arg, JSFPRGSZ)) return -EFAULT; p = abuf.off; togo = abuf.size; if ((togo & 3) || (p & 3)) return -EINVAL; - uptr = (char *) (unsigned long) abuf.data; + uptr = (char __user *) (unsigned long) abuf.data; while (togo != 0) { togo -= 4; if (copy_from_user(&b.s[0], uptr, 4)) @@ -390,19 +390,20 @@ static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd, unsigned long arg) { int error = -ENOTTY; + void __user *argp = (void __user *)arg; if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { case JSFLASH_IDENT: - if (copy_to_user((void *)arg, &jsf0.id, JSFIDSZ)) + if (copy_to_user(argp, &jsf0.id, JSFIDSZ)) return -EFAULT; break; case JSFLASH_ERASE: error = jsf_ioctl_erase(arg); break; case JSFLASH_PROGRAM: - error = jsf_ioctl_program(arg); + error = jsf_ioctl_program(argp); break; } -- cgit v1.2.3 From fec607fff973b1d7805c1bbce5834690857e7801 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:54:54 -0500 Subject: [PATCH] sbus/char/uctrl: missing prototypes and NULL noise removal Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/sbus/char/uctrl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index 858cc683f85..e2d9a7c8542 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c @@ -309,7 +309,7 @@ static void uctrl_do_txn(struct uctrl_txn *txn) } } -void uctrl_get_event_status() +void uctrl_get_event_status(void) { struct uctrl_driver *driver = &drv; struct uctrl_txn txn; @@ -318,7 +318,7 @@ void uctrl_get_event_status() txn.opcode = READ_EVENT_STATUS; txn.inbits = 0; txn.outbits = 2; - txn.inbuf = 0; + txn.inbuf = NULL; txn.outbuf = outbits; uctrl_do_txn(&txn); @@ -329,7 +329,7 @@ void uctrl_get_event_status() dprintk(("ev is %x\n", driver->status.event_status)); } -void uctrl_get_external_status() +void uctrl_get_external_status(void) { struct uctrl_driver *driver = &drv; struct uctrl_txn txn; @@ -339,7 +339,7 @@ void uctrl_get_external_status() txn.opcode = READ_EXTERNAL_STATUS; txn.inbits = 0; txn.outbits = 2; - txn.inbuf = 0; + txn.inbuf = NULL; txn.outbuf = outbits; uctrl_do_txn(&txn); @@ -414,7 +414,7 @@ static void __exit ts102_uctrl_cleanup(void) if (driver->irq) free_irq(driver->irq, driver); if (driver->regs) - driver->regs = 0; + driver->regs = NULL; } module_init(ts102_uctrl_init); -- cgit v1.2.3 From c316ef0494eec2d08df2f083fc06fc06a6fd48c6 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:55:44 -0500 Subject: [PATCH] sparc/kernel/time: __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 24814d58f9e..7dadcdb4ca4 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c @@ -49,7 +49,7 @@ DEFINE_SPINLOCK(rtc_lock); enum sparc_clock_type sp_clock_typ; DEFINE_SPINLOCK(mostek_lock); void __iomem *mstk48t02_regs = NULL; -static struct mostek48t08 *mstk48t08_regs = NULL; +static struct mostek48t08 __iomem *mstk48t08_regs = NULL; static int set_rtc_mmss(unsigned long); static int sbus_do_settimeofday(struct timespec *tv); @@ -342,7 +342,7 @@ static __inline__ void clock_probe(void) /* XXX r/o attribute is somewhere in r.flags */ r.flags = clk_reg[0].which_io; r.start = clk_reg[0].phys_addr; - mstk48t08_regs = (struct mostek48t08 *) sbus_ioremap(&r, 0, + mstk48t08_regs = sbus_ioremap(&r, 0, sizeof(struct mostek48t08), "mk48t08"); mstk48t02_regs = &mstk48t08_regs->regs; -- cgit v1.2.3 From e4fe342f932346a306f98f5401ad510b890c0a15 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 4 Dec 2005 18:48:45 -0500 Subject: [PATCH] sparc: NULL noise removal (ebus.c) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/ebus.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c index 1754192c69d..5c3529ceb5d 100644 --- a/arch/sparc/kernel/ebus.c +++ b/arch/sparc/kernel/ebus.c @@ -22,7 +22,7 @@ #include #include -struct linux_ebus *ebus_chain = 0; +struct linux_ebus *ebus_chain = NULL; /* We are together with pcic.c under CONFIG_PCI. */ extern unsigned int pcic_pin_to_irq(unsigned int, char *name); @@ -46,7 +46,7 @@ static struct ebus_device_irq je1_1[] = { { "SUNW,CS4231", 0 }, { "parallel", 0 }, { "se", 2 }, - { 0, 0 } + { NULL, 0 } }; /* @@ -55,7 +55,7 @@ static struct ebus_device_irq je1_1[] = { */ static struct ebus_system_entry ebus_blacklist[] = { { "SUNW,JavaEngine1", je1_1 }, - { 0, 0 } + { NULL, NULL } }; static struct ebus_device_irq *ebus_blackp = NULL; @@ -233,7 +233,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ebus_alloc(sizeof(struct linux_ebus_child)); child = dev->children; - child->next = 0; + child->next = NULL; child->parent = dev; child->bus = dev->bus; fill_ebus_child(node, ®s[0], child); @@ -243,7 +243,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev) ebus_alloc(sizeof(struct linux_ebus_child)); child = child->next; - child->next = 0; + child->next = NULL; child->parent = dev; child->bus = dev->bus; fill_ebus_child(node, ®s[0], child); @@ -275,7 +275,7 @@ void __init ebus_init(void) } } - pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0); + pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, NULL); if (!pdev) { return; } @@ -284,7 +284,7 @@ void __init ebus_init(void) ebus_chain = ebus = (struct linux_ebus *) ebus_alloc(sizeof(struct linux_ebus)); - ebus->next = 0; + ebus->next = NULL; while (ebusnd) { @@ -325,8 +325,8 @@ void __init ebus_init(void) ebus_alloc(sizeof(struct linux_ebus_device)); dev = ebus->devices; - dev->next = 0; - dev->children = 0; + dev->next = NULL; + dev->children = NULL; dev->bus = ebus; fill_ebus_device(nd, dev); @@ -335,8 +335,8 @@ void __init ebus_init(void) ebus_alloc(sizeof(struct linux_ebus_device)); dev = dev->next; - dev->next = 0; - dev->children = 0; + dev->next = NULL; + dev->children = NULL; dev->bus = ebus; fill_ebus_device(nd, dev); } @@ -353,7 +353,7 @@ void __init ebus_init(void) ebus->next = (struct linux_ebus *) ebus_alloc(sizeof(struct linux_ebus)); ebus = ebus->next; - ebus->next = 0; + ebus->next = NULL; ++num_ebus; } if (pdev) -- cgit v1.2.3 From a32972965e23471f0762a1136f80990ebf72406a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 05:56:39 -0500 Subject: [PATCH] sun4c_memerr_reg __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/mm/sun4c.c | 2 +- include/asm-sparc/memreg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 1d560390e28..731f19603ca 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -497,7 +497,7 @@ static void __init sun4c_probe_mmu(void) patch_kernel_fault_handler(); } -volatile unsigned long *sun4c_memerr_reg = NULL; +volatile unsigned long __iomem *sun4c_memerr_reg = NULL; void __init sun4c_probe_memerr_reg(void) { diff --git a/include/asm-sparc/memreg.h b/include/asm-sparc/memreg.h index c0498d3baf9..5fb95c828da 100644 --- a/include/asm-sparc/memreg.h +++ b/include/asm-sparc/memreg.h @@ -36,7 +36,7 @@ /* Memory parity error register with associated bit constants. */ #ifndef __ASSEMBLY__ -extern __volatile__ unsigned long *sun4c_memerr_reg; +extern __volatile__ unsigned long __iomem *sun4c_memerr_reg; #endif #define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */ -- cgit v1.2.3 From 80ce8baf5da730c87194e2e38a4cfca0254f9599 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 6 Dec 2005 06:04:55 -0500 Subject: [PATCH] arch/sparc/kernel/led.c __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/sparc/kernel/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c index 2a3afca453c..313d1620ae8 100644 --- a/arch/sparc/kernel/led.c +++ b/arch/sparc/kernel/led.c @@ -55,7 +55,7 @@ static int led_read_proc(char *buf, char **start, off_t offset, int count, return len; } -static int led_write_proc(struct file *file, const char *buffer, +static int led_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { char *buf = NULL; -- cgit v1.2.3 From b53cb2a4ab276796ad299597d6e7e2317b514ca8 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:19 +0000 Subject: [PATCH] iscsi gfp_t annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/scsi_transport_iscsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 4fea3e4edaa..3d8009f5534 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -3368,7 +3368,7 @@ iscsi_conn_set_param(iscsi_connh_t connh, enum iscsi_param param, switch(param) { case ISCSI_PARAM_MAX_RECV_DLENGTH: { char *saveptr = conn->data; - int flags = GFP_KERNEL; + gfp_t flags = GFP_KERNEL; if (conn->data_size >= value) { conn->max_recv_dlength = value; diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 49fd18c1a9c..e08462d50c9 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -249,7 +249,7 @@ static inline struct list_head *skb_to_lh(struct sk_buff *skb) } static void* -mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) +mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data) { struct mempool_zone *zone = pool_data; -- cgit v1.2.3 From 51bfb75b0b2652f60ab1200627e9041f4624c819 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:24 +0000 Subject: [PATCH] xfs: missing gfp_t annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/xfs/quota/xfs_qm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 1aea42d71a6..5328a293712 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c @@ -78,7 +78,7 @@ STATIC int xfs_qm_dqhashlock_nowait(xfs_dquot_t *); STATIC int xfs_qm_init_quotainos(xfs_mount_t *); STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); -STATIC int xfs_qm_shake(int, unsigned int); +STATIC int xfs_qm_shake(int, gfp_t); #ifdef DEBUG extern mutex_t qcheck_lock; @@ -2197,7 +2197,7 @@ xfs_qm_shake_freelist( */ /* ARGSUSED */ STATIC int -xfs_qm_shake(int nr_to_scan, unsigned int gfp_mask) +xfs_qm_shake(int nr_to_scan, gfp_t gfp_mask) { int ndqused, nfree, n; -- cgit v1.2.3 From 37eb47ed445f4ca1247f3c7b600c0885c2ca8c31 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:29 +0000 Subject: [PATCH] s2io: __iomem annotations for recent changes Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/net/s2io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index e57df8dfe6b..669dd52c412 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -3078,7 +3078,7 @@ int s2io_set_swapper(nic_t * sp) static int wait_for_msix_trans(nic_t *nic, int i) { - XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; + XENA_dev_config_t __iomem *bar0 = nic->bar0; u64 val64; int ret = 0, cnt = 0; @@ -3099,7 +3099,7 @@ static int wait_for_msix_trans(nic_t *nic, int i) void restore_xmsi_data(nic_t *nic) { - XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; + XENA_dev_config_t __iomem *bar0 = nic->bar0; u64 val64; int i; @@ -3117,7 +3117,7 @@ void restore_xmsi_data(nic_t *nic) static void store_xmsi_data(nic_t *nic) { - XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; + XENA_dev_config_t __iomem *bar0 = nic->bar0; u64 val64, addr, data; int i; @@ -3140,7 +3140,7 @@ static void store_xmsi_data(nic_t *nic) int s2io_enable_msi(nic_t *nic) { - XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; + XENA_dev_config_t __iomem *bar0 = nic->bar0; u16 msi_ctrl, msg_val; struct config_param *config = &nic->config; struct net_device *dev = nic->dev; @@ -3190,7 +3190,7 @@ int s2io_enable_msi(nic_t *nic) int s2io_enable_msi_x(nic_t *nic) { - XENA_dev_config_t *bar0 = (XENA_dev_config_t *) nic->bar0; + XENA_dev_config_t __iomem *bar0 = nic->bar0; u64 tx_mat, rx_mat; u16 msi_control; /* Temp variable */ int ret, i, j, msix_indx = 1; -- cgit v1.2.3 From 53b3de1ea2f81de7050f247cd7fc63863887e8d7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:34 +0000 Subject: [PATCH] auerswald.c: %zd for size_t Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/usb/misc/auerswald.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 2a28ceeaa66..b293db3c28c 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -1696,7 +1696,7 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t int ret; wait_queue_t wait; - dbg ("auerchar_write %d bytes", len); + dbg ("auerchar_write %zd bytes", len); /* Error checking */ if (!ccp) -- cgit v1.2.3 From 8bcc247617deaf229962e9d663c69e65523519ab Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:39 +0000 Subject: [PATCH] em28xx: %zd for size_t Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/media/video/em28xx/em28xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index e8a1c224756..ec11619f8ea 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -126,7 +126,7 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count) const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ void *buff = NULL; u32 i; - em28xx_coredbg("requested %i buffers with size %i", count, imagesize); + em28xx_coredbg("requested %i buffers with size %zd", count, imagesize); if (count > EM28XX_NUM_FRAMES) count = EM28XX_NUM_FRAMES; -- cgit v1.2.3 From 8b8a4e33e4a320735f353a092013b314f142493d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:44 +0000 Subject: [PATCH] i386,amd64: mmconfig __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/i386/pci/mmconfig.c | 2 +- arch/x86_64/pci/mmconfig.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 08a08490121..70a9cc132cf 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c @@ -155,7 +155,7 @@ static __init void unreachable_devices(void) addr = get_base_addr(0, 0, PCI_DEVFN(i, 0)); if (addr != 0) pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0)); - if (addr == 0 || readl((u32 *)addr) != val1) + if (addr == 0 || readl((u32 __iomem *)addr) != val1) set_bit(i, fallback_slots); spin_unlock_irqrestore(&pci_config_lock, flags); } diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c index 9c4f907e301..f16c0d57c55 100644 --- a/arch/x86_64/pci/mmconfig.c +++ b/arch/x86_64/pci/mmconfig.c @@ -18,11 +18,11 @@ static DECLARE_BITMAP(fallback_slots, 32); /* Static virtual mapping of the MMCONFIG aperture */ struct mmcfg_virt { struct acpi_table_mcfg_config *cfg; - char *virt; + char __iomem *virt; }; static struct mmcfg_virt *pci_mmcfg_virt; -static char *get_virt(unsigned int seg, unsigned bus) +static char __iomem *get_virt(unsigned int seg, unsigned bus) { int cfg_num = -1; struct acpi_table_mcfg_config *cfg; @@ -43,9 +43,9 @@ static char *get_virt(unsigned int seg, unsigned bus) } } -static char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) +static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) { - char *addr; + char __iomem *addr; if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), &fallback_slots)) return NULL; addr = get_virt(seg, bus); @@ -57,7 +57,7 @@ static char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn static int pci_mmcfg_read(unsigned int seg, unsigned int bus, unsigned int devfn, int reg, int len, u32 *value) { - char *addr; + char __iomem *addr; /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) @@ -85,7 +85,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus, static int pci_mmcfg_write(unsigned int seg, unsigned int bus, unsigned int devfn, int reg, int len, u32 value) { - char *addr; + char __iomem *addr; /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) @@ -127,7 +127,7 @@ static __init void unreachable_devices(void) int i; for (i = 0; i < 32; i++) { u32 val1; - char *addr; + char __iomem *addr; pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1); if (val1 == 0xffffffff) -- cgit v1.2.3 From b16b88e55d808a6324d5ff02d8c686f7884870f8 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:50 +0000 Subject: [PATCH] i386,amd64: ioremap.c __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/i386/mm/ioremap.c | 2 +- arch/x86_64/mm/ioremap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index 8498b5ac395..247fde76aae 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c @@ -245,7 +245,7 @@ void iounmap(volatile void __iomem *addr) addr < phys_to_virt(ISA_END_ADDRESS)) return; - addr = (volatile void *)(PAGE_MASK & (unsigned long __force)addr); + addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr); /* Use the vm area unlocked, assuming the caller ensures there isn't another iounmap for the same address diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c index 0d260e4492f..ae207064201 100644 --- a/arch/x86_64/mm/ioremap.c +++ b/arch/x86_64/mm/ioremap.c @@ -263,7 +263,7 @@ void iounmap(volatile void __iomem *addr) addr < phys_to_virt(ISA_END_ADDRESS)) return; - addr = (volatile void *)(PAGE_MASK & (unsigned long __force)addr); + addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr); /* Use the vm area unlocked, assuming the caller ensures there isn't another iounmap for the same address in parallel. Reuse of the virtual address is prevented by -- cgit v1.2.3 From c4aa02eb3939c5004782454434e4d50de471b53d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:17:55 +0000 Subject: [PATCH] cm4000_cs: __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/char/pcmcia/cm4000_cs.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index ef011ef5dc4..61681c9f3f7 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1444,6 +1444,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, dev_link_t *link; int size; int rc; + void __user *argp = (void __user *)arg; #ifdef PCMCIA_DEBUG char *ioctl_names[CM_IOC_MAXNR + 1] = { [_IOC_NR(CM_IOCGSTATUS)] "CM_IOCGSTATUS", @@ -1481,11 +1482,11 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, _IOC_DIR(cmd), _IOC_READ, _IOC_WRITE, size, cmd); if (_IOC_DIR(cmd) & _IOC_READ) { - if (!access_ok(VERIFY_WRITE, (void *)arg, size)) + if (!access_ok(VERIFY_WRITE, argp, size)) return -EFAULT; } if (_IOC_DIR(cmd) & _IOC_WRITE) { - if (!access_ok(VERIFY_READ, (void *)arg, size)) + if (!access_ok(VERIFY_READ, argp, size)) return -EFAULT; } @@ -1506,14 +1507,14 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, status |= CM_NO_READER; if (test_bit(IS_BAD_CARD, &dev->flags)) status |= CM_BAD_CARD; - if (copy_to_user((int *)arg, &status, sizeof(int))) + if (copy_to_user(argp, &status, sizeof(int))) return -EFAULT; } return 0; case CM_IOCGATR: DEBUGP(4, dev, "... in CM_IOCGATR\n"); { - struct atreq *atreq = (struct atreq *) arg; + struct atreq __user *atreq = argp; int tmp; /* allow nonblocking io and being interrupted */ if (wait_event_interruptible @@ -1597,7 +1598,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, { struct ptsreq krnptsreq; - if (copy_from_user(&krnptsreq, (struct ptsreq *) arg, + if (copy_from_user(&krnptsreq, argp, sizeof(struct ptsreq))) return -EFAULT; @@ -1641,7 +1642,7 @@ static int cmm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, int old_pc_debug = 0; old_pc_debug = pc_debug; - if (copy_from_user(&pc_debug, (int *)arg, sizeof(int))) + if (copy_from_user(&pc_debug, argp, sizeof(int))) return -EFAULT; if (old_pc_debug != pc_debug) -- cgit v1.2.3 From 5ad9201be7f7d52d712fe3c3e841fdc19216ede1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:00 +0000 Subject: [PATCH] dell_rbu: NULL noise removal Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/firmware/dell_rbu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index 6d83299e7c9..dfedb777d8c 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c @@ -105,8 +105,8 @@ static int create_packet(void *data, size_t length) int ordernum = 0; int retval = 0; unsigned int packet_array_size = 0; - void **invalid_addr_packet_array = 0; - void *packet_data_temp_buf = 0; + void **invalid_addr_packet_array = NULL; + void *packet_data_temp_buf = NULL; unsigned int idx = 0; pr_debug("create_packet: entry \n"); @@ -178,7 +178,7 @@ static int create_packet(void *data, size_t length) packet_data_temp_buf), allocation_floor); invalid_addr_packet_array[idx++] = packet_data_temp_buf; - packet_data_temp_buf = 0; + packet_data_temp_buf = NULL; } } spin_lock(&rbu_data.lock); -- cgit v1.2.3 From e896fd9861181140617aa9ff3a54dac25e46351d Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:05 +0000 Subject: [PATCH] wdrtas.c: fix __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/char/watchdog/wdrtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c index 619e2ffca33..dacfe31cacc 100644 --- a/drivers/char/watchdog/wdrtas.c +++ b/drivers/char/watchdog/wdrtas.c @@ -320,7 +320,7 @@ static int wdrtas_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - int __user *argp = (void *)arg; + int __user *argp = (void __user *)arg; int i; static struct watchdog_info wdinfo = { .options = WDRTAS_SUPPORTED_MASK, -- cgit v1.2.3 From cd0306656c15f355e0e533cc0f08691bb98ca912 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:10 +0000 Subject: [PATCH] cyber2000fb.c __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/video/cyber2000fb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index c589d23e7f9..a9300f930ef 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c @@ -1512,7 +1512,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) * I/O cycles storing into a reserved memory space at * physical address 0x3000000 */ - unsigned char *iop; + unsigned char __iomem *iop; iop = ioremap(0x3000000, 0x5000); if (iop == NULL) { @@ -1526,7 +1526,7 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb) writeb(EXT_BIU_MISC, iop + 0x3ce); writeb(EXT_BIU_MISC_LIN_ENABLE, iop + 0x3cf); - iounmap((void *)iop); + iounmap(iop); #else /* * Most other machine types are "normal", so -- cgit v1.2.3 From d22043940eb8d660df9a94e8e439ab4d3d16edab Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:15 +0000 Subject: [PATCH] arcfb __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/video/arcfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 080db812ca4..2784f0a9d69 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c @@ -441,7 +441,7 @@ static int arcfb_ioctl(struct inode *inode, struct file *file, * the fb. it's inefficient for them to do anything less than 64*8 * writes since we update the lcd in each write() anyway. */ -static ssize_t arcfb_write(struct file *file, const char *buf, size_t count, +static ssize_t arcfb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { /* modded from epson 1355 */ -- cgit v1.2.3 From 538bacf8a4802d209f955726b66891b8a921dabf Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:20 +0000 Subject: [PATCH] __user annotations (booke_wdt.c) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/char/watchdog/booke_wdt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index 65830ec7104..c800cce73c1 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c @@ -72,7 +72,7 @@ static __inline__ void booke_wdt_ping(void) /* * booke_wdt_write: */ -static ssize_t booke_wdt_write (struct file *file, const char *buf, +static ssize_t booke_wdt_write (struct file *file, const char __user *buf, size_t count, loff_t *ppos) { booke_wdt_ping(); @@ -92,14 +92,15 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { u32 tmp = 0; + u32 __user *p = (u32 __user *)arg; switch (cmd) { case WDIOC_GETSUPPORT: - if (copy_to_user ((struct watchdog_info *) arg, &ident, + if (copy_to_user ((struct watchdog_info __user *) arg, &ident, sizeof(struct watchdog_info))) return -EFAULT; case WDIOC_GETSTATUS: - return put_user(ident.options, (u32 *) arg); + return put_user(ident.options, p); case WDIOC_GETBOOTSTATUS: /* XXX: something is clearing TSR */ tmp = mfspr(SPRN_TSR) & TSR_WRS(3); @@ -109,14 +110,14 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, booke_wdt_ping(); return 0; case WDIOC_SETTIMEOUT: - if (get_user(booke_wdt_period, (u32 *) arg)) + if (get_user(booke_wdt_period, p)) return -EFAULT; mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period)); return 0; case WDIOC_GETTIMEOUT: - return put_user(booke_wdt_period, (u32 *) arg); + return put_user(booke_wdt_period, p); case WDIOC_SETOPTIONS: - if (get_user(tmp, (u32 *) arg)) + if (get_user(tmp, p)) return -EINVAL; if (tmp == WDIOS_ENABLECARD) { booke_wdt_ping(); -- cgit v1.2.3 From 78d9955bb06493e7bd78e43dfdc17fb5f1dc59b6 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:25 +0000 Subject: [PATCH] missing prototype (mm/page_alloc.c) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3b21a13d841..fe14a8c87fc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1896,7 +1896,7 @@ static int __devinit pageset_cpuup_callback(struct notifier_block *nfb, static struct notifier_block pageset_notifier = { &pageset_cpuup_callback, NULL, 0 }; -void __init setup_per_cpu_pageset() +void __init setup_per_cpu_pageset(void) { int err; -- cgit v1.2.3 From d3a880e1ff6713b4c846e4d2526a8c7e6ad8469c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:30 +0000 Subject: [PATCH] Address of void __user * is void __user * *, not void * __user * Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- net/sctp/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index d890dfa8818..1f7f244806b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3425,7 +3425,7 @@ static int sctp_copy_laddrs_to_user_old(struct sock *sk, __u16 port, int max_add } static int sctp_copy_laddrs_to_user(struct sock *sk, __u16 port, - void * __user *to, size_t space_left) + void __user **to, size_t space_left) { struct list_head *pos; struct sctp_sockaddr_entry *addr; -- cgit v1.2.3 From b3e5b5b2277f9c047082dcb309f665fe8b5706c1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:40 +0000 Subject: [PATCH] ia64 sn __iomem annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/ia64/sn/pci/pcibr/pcibr_reg.c | 48 +++++++++++++++++++------------------- arch/ia64/sn/pci/tioca_provider.c | 12 +++++----- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c index 5d534091262..79fdb91d725 100644 --- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c +++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c @@ -25,7 +25,7 @@ union br_ptr { */ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -38,14 +38,14 @@ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) default: panic ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -58,7 +58,7 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) default: panic ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } @@ -68,7 +68,7 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) */ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; uint64_t ret = 0; if (pcibus_info) { @@ -82,7 +82,7 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info) default: panic ("pcireg_tflush_get: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } @@ -98,7 +98,7 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info) */ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; uint64_t ret = 0; if (pcibus_info) { @@ -112,7 +112,7 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info) default: panic ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } return ret; @@ -123,7 +123,7 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info) */ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -136,14 +136,14 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) default: panic ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -156,7 +156,7 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) default: panic ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } @@ -167,7 +167,7 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n, uint64_t addr) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -186,7 +186,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n, default: panic ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } @@ -196,7 +196,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n, */ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -209,7 +209,7 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n) default: panic ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } @@ -219,7 +219,7 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n) */ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; uint64_t ret = 0; if (pcibus_info) { @@ -233,7 +233,7 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device) __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]); break; default: - panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr); + panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", ptr); } } @@ -244,7 +244,7 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device) void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index, uint64_t val) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -257,15 +257,15 @@ void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index, default: panic ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } } -uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index) +uint64_t __iomem *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index) { - union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; - uint64_t *ret = (uint64_t *) 0; + union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base; + uint64_t __iomem *ret = NULL; if (pcibus_info) { switch (pcibus_info->pbi_bridge_type) { @@ -278,7 +278,7 @@ uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index) default: panic ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p", - (void *)ptr); + ptr); } } return ret; diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c index 46b646a6d34..27aa1842dac 100644 --- a/arch/ia64/sn/pci/tioca_provider.c +++ b/arch/ia64/sn/pci/tioca_provider.c @@ -38,10 +38,10 @@ tioca_gart_init(struct tioca_kernel *tioca_kern) uint64_t offset; struct page *tmp; struct tioca_common *tioca_common; - struct tioca *ca_base; + struct tioca __iomem *ca_base; tioca_common = tioca_kern->ca_common; - ca_base = (struct tioca *)tioca_common->ca_common.bs_base; + ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base; if (list_empty(tioca_kern->ca_devices)) return 0; @@ -215,7 +215,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern) { int cap_ptr; uint32_t reg; - struct tioca *tioca_base; + struct tioca __iomem *tioca_base; struct pci_dev *pdev; struct tioca_common *common; @@ -257,7 +257,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern) * Set ca's fw to match */ - tioca_base = (struct tioca *)common->ca_common.bs_base; + tioca_base = (struct tioca __iomem*)common->ca_common.bs_base; __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE); } @@ -322,7 +322,7 @@ static uint64_t tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr) { struct tioca_common *tioca_common; - struct tioca *ca_base; + struct tioca __iomem *ca_base; uint64_t ct_addr; dma_addr_t bus_addr; uint32_t node_upper; @@ -330,7 +330,7 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr) struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev); tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info; - ca_base = (struct tioca *)tioca_common->ca_common.bs_base; + ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base; ct_addr = PHYS_TO_TIODMA(paddr); if (!ct_addr) -- cgit v1.2.3 From 94299171dd269aab0c97f6254cedb381f10e6348 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:45 +0000 Subject: [PATCH] dst_ca __user annotations, portability fixes Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/media/dvb/bt8xx/dst_ca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index e6541aff399..2239651969c 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -406,7 +406,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, } dprintk(verbose, DST_CA_DEBUG, 1, " "); - if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) { + if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg))) { result = -EFAULT; goto free_mem_and_exit; } @@ -579,7 +579,7 @@ static int dst_ca_release(struct inode *inode, struct file *file) return 0; } -static int dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) +static ssize_t dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) { int bytes_read = 0; @@ -588,7 +588,7 @@ static int dst_ca_read(struct file *file, char __user *buffer, size_t length, lo return bytes_read; } -static int dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset) +static ssize_t dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset) { dprintk(verbose, DST_CA_DEBUG, 1, " Device write."); -- cgit v1.2.3 From e17f008bbeabcd1302d6cf4b5b9659be6d80f1db Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:50 +0000 Subject: [PATCH] arch/alpha/kernel/machvec_impl.h: C99 struct initializer Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/alpha/kernel/machvec_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h index 4959b7a3e1e..11f996f24fd 100644 --- a/arch/alpha/kernel/machvec_impl.h +++ b/arch/alpha/kernel/machvec_impl.h @@ -41,7 +41,7 @@ #define CAT1(x,y) x##y #define CAT(x,y) CAT1(x,y) -#define DO_DEFAULT_RTC rtc_port: 0x70 +#define DO_DEFAULT_RTC .rtc_port = 0x70 #define DO_EV4_MMU \ .max_asn = EV4_MAX_ASN, \ -- cgit v1.2.3 From 7877327d9c360ac91f22e4c7f98bcb10c0180969 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:18:55 +0000 Subject: [PATCH] drivers/atm/adummy.c NULL noise removal Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/atm/adummy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c index d15c194be44..d1387cfe2d3 100644 --- a/drivers/atm/adummy.c +++ b/drivers/atm/adummy.c @@ -123,7 +123,7 @@ static int __init adummy_init(void) } memset(adummy_dev, 0, sizeof(struct adummy_dev)); - atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, 0); + atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL); if (!atm_dev) { printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); err = -ENODEV; -- cgit v1.2.3 From 833882b452046d3d5028f6293a0a6d6d3c1eee3c Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:19:00 +0000 Subject: [PATCH] mwave: missing __user in ioctl struct declaration Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/char/mwave/mwavepub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/mwave/mwavepub.h b/drivers/char/mwave/mwavepub.h index f1f9da7a65c..60c961ae23b 100644 --- a/drivers/char/mwave/mwavepub.h +++ b/drivers/char/mwave/mwavepub.h @@ -69,7 +69,7 @@ typedef struct _MW_ABILITIES { typedef struct _MW_READWRITE { unsigned short usDspAddress; /* The dsp address */ unsigned long ulDataLength; /* The size in bytes of the data or user buffer */ - void *pBuf; /* Input:variable sized buffer */ + void __user *pBuf; /* Input:variable sized buffer */ } MW_READWRITE, *pMW_READWRITE; #define IOCTL_MW_RESET _IO(MWAVE_MINOR,1) -- cgit v1.2.3 From 81f0a91e8f58a7784afe39cda9ac47e9231412a4 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:19:05 +0000 Subject: [PATCH] drivers/input/misc/wistron_btns.c NULL noise removal Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/input/misc/wistron_btns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 49d0416a2a9..bac3085185f 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -320,7 +320,7 @@ static struct dmi_system_id dmi_ids[] = { }, .driver_data = keymap_acer_aspire_1500 }, - { 0, } + { NULL, } }; static int __init select_keymap(void) -- cgit v1.2.3 From ebbd1bce79b3b4778d9e1914a22c42fcfa869cd9 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 15 Dec 2005 09:19:10 +0000 Subject: [PATCH] arch/powerpc/kernel/syscalls.c __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/powerpc/kernel/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index f72ced11212..91b93d917b6 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -247,7 +247,7 @@ long ppc64_personality(unsigned long personality) #define OVERRIDE_MACHINE 0 #endif -static inline int override_machine(char *mach) +static inline int override_machine(char __user *mach) { if (OVERRIDE_MACHINE) { /* change ppc64 to ppc */ -- cgit v1.2.3 From 7767e126ca0f32cd0438455fdd9650f909d2eeb3 Mon Sep 17 00:00:00 2001 From: Paolo Galtieri Date: Thu, 15 Dec 2005 12:34:28 -0800 Subject: [PATCH] IPMI oops fix While doing some testing I discovered that if the BIOS on a board does not properly setup the DMI information it leads to a panic in the IPMI code. The panic is due to dereferencing a pointer which is not initialized. The pointer is initialized in port_setup() and/or mem_setup() and used in init_one_smi() and cleanup_one_si(), however if either port_setup() or mem_setup() return ENODEV the pointer does not get initialized. Signed-off-by: Paolo Galtieri Acked-by: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/ipmi/ipmi_si_intf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 01a1f6badb5..beea450ee4b 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2399,7 +2399,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi) new_smi->handlers->cleanup(new_smi->si_sm); kfree(new_smi->si_sm); } - new_smi->io_cleanup(new_smi); + if (new_smi->io_cleanup) + new_smi->io_cleanup(new_smi); return rv; } @@ -2518,7 +2519,8 @@ static void __exit cleanup_one_si(struct smi_info *to_clean) kfree(to_clean->si_sm); - to_clean->io_cleanup(to_clean); + if (to_clean->io_cleanup) + to_clean->io_cleanup(to_clean); } static __exit void cleanup_ipmi_si(void) -- cgit v1.2.3 From 2f40fb72a2121da44c35f2588ee9abce1dffa2a9 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 15 Dec 2005 12:34:29 -0800 Subject: [PATCH] drivers/base/memory.c: unexport the static (sic) memory_sysdev_class We can't export a static struct to modules. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/base/memory.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index b7ddd651d66..bc3ca6a656b 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -28,7 +28,6 @@ static struct sysdev_class memory_sysdev_class = { set_kset_name(MEMORY_CLASS_NAME), }; -EXPORT_SYMBOL(memory_sysdev_class); static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) { -- cgit v1.2.3 From 7b6666530e2736f190a2629c8abe34275054449f Mon Sep 17 00:00:00 2001 From: Sergei Shtylylov Date: Thu, 15 Dec 2005 12:34:30 -0800 Subject: [PATCH] Au1550 AC'97 OSS driver spinlock fixes We have found some issues with Au1550 AC'97 OSS driver in 2.6 (sound/oss/au1550_ac97.c), though it also should concern 2.4 driver (drivers/sound/au1550_psc.c). start_dac() grabs a spinlock already held by its caller, au1550_write(). This doesn't show up with the standard UP spinlock impelmentation but when the different one (mutex based) is in use, a lockup happens. And the interrupt handlers also didn't grab the spinlock -- that's OK in the usual kernel but not when the IRQ handlers are threaded. So, they're grabbing the spinlock now (as every correct interrupt handler should do). Signed-off-by: Konstantin Baidarov Signed-off-by: Sergei Shtylyov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/au1550_ac97.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 6b46a8a4b1c..b963c550dae 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c @@ -578,17 +578,15 @@ set_recv_slots(int num_channels) } while ((stat & PSC_AC97STAT_DR) == 0); } +/* Hold spinlock for both start_dac() and start_adc() calls */ static void start_dac(struct au1550_state *s) { struct dmabuf *db = &s->dma_dac; - unsigned long flags; if (!db->stopped) return; - spin_lock_irqsave(&s->lock, flags); - set_xmit_slots(db->num_channels); au_writel(PSC_AC97PCR_TC, PSC_AC97PCR); au_sync(); @@ -598,8 +596,6 @@ start_dac(struct au1550_state *s) au1xxx_dbdma_start(db->dmanr); db->stopped = 0; - - spin_unlock_irqrestore(&s->lock, flags); } static void @@ -718,7 +714,6 @@ prog_dmabuf_dac(struct au1550_state *s) } -/* hold spinlock for the following */ static void dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) { @@ -726,6 +721,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) struct dmabuf *db = &s->dma_dac; u32 ac97c_stat; + spin_lock(&s->lock); + ac97c_stat = au_readl(PSC_AC97STAT); if (ac97c_stat & (AC97C_XU | AC97C_XO | AC97C_TE)) pr_debug("AC97C status = 0x%08x\n", ac97c_stat); @@ -747,6 +744,8 @@ dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* wake up anybody listening */ if (waitqueue_active(&db->wait)) wake_up(&db->wait); + + spin_unlock(&s->lock); } @@ -758,6 +757,8 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) u32 obytes; char *obuf; + spin_lock(&s->lock); + /* Pull the buffer from the dma queue. */ au1xxx_dbdma_get_dest(dp->dmanr, (void *)(&obuf), &obytes); @@ -765,6 +766,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) if ((dp->count + obytes) > dp->dmasize) { /* Overrun. Stop ADC and log the error */ + spin_unlock(&s->lock); stop_adc(s); dp->error++; err("adc overrun"); @@ -787,6 +789,7 @@ adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (waitqueue_active(&dp->wait)) wake_up(&dp->wait); + spin_unlock(&s->lock); } static loff_t @@ -1048,9 +1051,9 @@ au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos) /* wait for samples in ADC dma buffer */ do { + spin_lock_irqsave(&s->lock, flags); if (db->stopped) start_adc(s); - spin_lock_irqsave(&s->lock, flags); avail = db->count; if (avail <= 0) __set_current_state(TASK_INTERRUPTIBLE); @@ -1570,15 +1573,19 @@ au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, if (get_user(val, (int *) arg)) return -EFAULT; if (file->f_mode & FMODE_READ) { - if (val & PCM_ENABLE_INPUT) + if (val & PCM_ENABLE_INPUT) { + spin_lock_irqsave(&s->lock, flags); start_adc(s); - else + spin_unlock_irqrestore(&s->lock, flags); + } else stop_adc(s); } if (file->f_mode & FMODE_WRITE) { - if (val & PCM_ENABLE_OUTPUT) + if (val & PCM_ENABLE_OUTPUT) { + spin_lock_irqsave(&s->lock, flags); start_dac(s); - else + spin_unlock_irqrestore(&s->lock, flags); + } else stop_dac(s); } return 0; -- cgit v1.2.3 From 42e33148df38c60b99d984b76b302c64397ebe4c Mon Sep 17 00:00:00 2001 From: "James.Smart@Emulex.Com" Date: Thu, 15 Dec 2005 09:56:22 -0500 Subject: [SCSI] fix for fc transport recursion problem. In the scenario that a link was broken, the devloss timer for each rport was expire at roughly the same time, causing lots of "delete" workqueue items being queued. Depth is dependent upon the number of rports that were on the link. The rport target remove calls were calling flush_scheduled_work(), which would interrupt the stream, and start the next workqueue item, which did the same thing, and so on until recursion depth was large. This fix stops the recursion in the initial delete path, and pushes it off to a host-level work item that reaps the dead rports. Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_fc.c | 59 +++++++++++++++++++++++++++++++++++++--- include/scsi/scsi_transport_fc.h | 11 ++++++++ 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 6cd5931d9a5..2a1a99a2ef5 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -105,6 +105,7 @@ static struct { { FC_PORTSTATE_LINKDOWN, "Linkdown" }, { FC_PORTSTATE_ERROR, "Error" }, { FC_PORTSTATE_LOOPBACK, "Loopback" }, + { FC_PORTSTATE_DELETED, "Deleted" }, }; fc_enum_name_search(port_state, fc_port_state, fc_port_state_names) #define FC_PORTSTATE_MAX_NAMELEN 20 @@ -211,6 +212,7 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names) #define FC_MGMTSRVR_PORTID 0x00000a +static void fc_shost_remove_rports(void *data); static void fc_timeout_deleted_rport(void *data); static void fc_scsi_scan_rport(void *data); static void fc_rport_terminate(struct fc_rport *rport); @@ -318,6 +320,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, fc_host_next_rport_number(shost) = 0; fc_host_next_target_id(shost) = 0; + fc_host_flags(shost) = 0; + INIT_WORK(&fc_host_rport_del_work(shost), fc_shost_remove_rports, shost); return 0; } @@ -387,6 +391,7 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \ struct fc_internal *i = to_fc_internal(shost->transportt); \ if ((i->f->get_rport_##field) && \ !((rport->port_state == FC_PORTSTATE_BLOCKED) || \ + (rport->port_state == FC_PORTSTATE_DELETED) || \ (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \ i->f->get_rport_##field(rport); \ return snprintf(buf, sz, format_string, cast rport->field); \ @@ -402,6 +407,7 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \ struct Scsi_Host *shost = rport_to_shost(rport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \ + (rport->port_state == FC_PORTSTATE_DELETED) || \ (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \ return -EBUSY; \ val = simple_strtoul(buf, NULL, 0); \ @@ -519,6 +525,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, struct Scsi_Host *shost = rport_to_shost(rport); struct fc_internal *i = to_fc_internal(shost->transportt); if ((rport->port_state == FC_PORTSTATE_BLOCKED) || + (rport->port_state == FC_PORTSTATE_DELETED) || (rport->port_state == FC_PORTSTATE_NOTPRESENT)) return -EBUSY; val = simple_strtoul(buf, NULL, 0); @@ -1769,7 +1776,7 @@ fc_timeout_deleted_rport(void *data) rport->maxframe_size = -1; rport->supported_classes = FC_COS_UNSPECIFIED; rport->roles = FC_RPORT_ROLE_UNKNOWN; - rport->port_state = FC_PORTSTATE_NOTPRESENT; + rport->port_state = FC_PORTSTATE_DELETED; /* remove the identifiers that aren't used in the consisting binding */ switch (fc_host_tgtid_bind_type(shost)) { @@ -1789,14 +1796,23 @@ fc_timeout_deleted_rport(void *data) break; } - spin_unlock_irqrestore(shost->host_lock, flags); - /* * As this only occurs if the remote port (scsi target) * went away and didn't come back - we'll remove * all attached scsi devices. + * + * We'll schedule the shost work item to perform the actual removal + * to avoid recursion in the different flush calls if we perform + * the removal in each target - and there are lots of targets + * whose timeouts fire at the same time. */ - fc_rport_tgt_remove(rport); + + if ( !(fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED)) { + fc_host_flags(shost) |= FC_SHOST_RPORT_DEL_SCHEDULED; + scsi_queue_work(shost, &fc_host_rport_del_work(shost)); + } + + spin_unlock_irqrestore(shost->host_lock, flags); } /** @@ -1818,6 +1834,41 @@ fc_scsi_scan_rport(void *data) } +/** + * fc_shost_remove_rports - called to remove all rports that are marked + * as in a deleted (not connected) state. + * + * @data: shost whose rports are to be looked at + **/ +static void +fc_shost_remove_rports(void *data) +{ + struct Scsi_Host *shost = (struct Scsi_Host *)data; + struct fc_rport *rport, *next_rport; + unsigned long flags; + + spin_lock_irqsave(shost->host_lock, flags); + while (fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED) { + + fc_host_flags(shost) &= ~FC_SHOST_RPORT_DEL_SCHEDULED; + +restart_search: + list_for_each_entry_safe(rport, next_rport, + &fc_host_rport_bindings(shost), peers) { + if (rport->port_state == FC_PORTSTATE_DELETED) { + rport->port_state = FC_PORTSTATE_NOTPRESENT; + spin_unlock_irqrestore(shost->host_lock, flags); + fc_rport_tgt_remove(rport); + spin_lock_irqsave(shost->host_lock, flags); + goto restart_search; + } + } + + } + spin_unlock_irqrestore(shost->host_lock, flags); +} + + MODULE_AUTHOR("Martin Hicks"); MODULE_DESCRIPTION("FC Transport Attributes"); MODULE_LICENSE("GPL"); diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index fac547d32a9..394f14a5b7c 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -79,6 +79,7 @@ enum fc_port_state { FC_PORTSTATE_LINKDOWN, FC_PORTSTATE_ERROR, FC_PORTSTATE_LOOPBACK, + FC_PORTSTATE_DELETED, }; @@ -325,8 +326,14 @@ struct fc_host_attrs { struct list_head rport_bindings; u32 next_rport_number; u32 next_target_id; + u8 flags; + struct work_struct rport_del_work; }; +/* values for struct fc_host_attrs "flags" field: */ +#define FC_SHOST_RPORT_DEL_SCHEDULED 0x01 + + #define fc_host_node_name(x) \ (((struct fc_host_attrs *)(x)->shost_data)->node_name) #define fc_host_port_name(x) \ @@ -365,6 +372,10 @@ struct fc_host_attrs { (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number) #define fc_host_next_target_id(x) \ (((struct fc_host_attrs *)(x)->shost_data)->next_target_id) +#define fc_host_flags(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->flags) +#define fc_host_rport_del_work(x) \ + (((struct fc_host_attrs *)(x)->shost_data)->rport_del_work) /* The functions by which the transport class and the driver communicate */ -- cgit v1.2.3 From 281ab031a8c9e5b593142eb4ec59a87faae8676a Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 16 Dec 2005 16:52:22 +1100 Subject: [PATCH] radeon drm: fix agp aperture map offset This finally fixes the radeon memory mapping bug that was incorrectly fixed by the previous patch. This time, we use the actual vram size as the size to calculate how far to move the AGP aperture from the framebuffer in card's memory space. If there are still issues with this patch, they are due to bugs in the X driver that I'm working on fixing too. Signed-off-by: Benjamin Herrenschmidt Cc: Mark M. Hoffman Cc: Paul Mackerras Signed-off-by: Linus Torvalds --- drivers/char/drm/radeon_cp.c | 9 +++++++-- drivers/char/drm/radeon_drv.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 9f2b4efd0c7..95ae9e0892a 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c @@ -1312,6 +1312,8 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) { drm_radeon_private_t *dev_priv = dev->dev_private;; + unsigned int mem_size; + DRM_DEBUG("\n"); dev_priv->is_pci = init->is_pci; @@ -1521,8 +1523,11 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) + dev_priv->fb_location) >> 10)); dev_priv->gart_size = init->gart_size; - dev_priv->gart_vm_start = dev_priv->fb_location - + RADEON_READ(RADEON_CONFIG_APER_SIZE) * 2; + + mem_size = RADEON_READ(RADEON_CONFIG_MEMSIZE); + if (mem_size == 0) + mem_size = 0x800000; + dev_priv->gart_vm_start = dev_priv->fb_location + mem_size; #if __OS_HAS_AGP if (!dev_priv->is_pci) diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index 7bda7e33d2b..d92ccee3e54 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h @@ -379,6 +379,7 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, # define RADEON_PLL_WR_EN (1 << 7) #define RADEON_CLOCK_CNTL_INDEX 0x0008 #define RADEON_CONFIG_APER_SIZE 0x0108 +#define RADEON_CONFIG_MEMSIZE 0x00f8 #define RADEON_CRTC_OFFSET 0x0224 #define RADEON_CRTC_OFFSET_CNTL 0x0228 # define RADEON_CRTC_TILE_EN (1 << 15) -- cgit v1.2.3 From f5899b5d4fa806403f547dc41312d017d94ec273 Mon Sep 17 00:00:00 2001 From: John Hawkes Date: Fri, 16 Dec 2005 10:00:24 -0800 Subject: [IA64] disable preemption in udelay() The udelay() inline for ia64 uses the ITC. If CONFIG_PREEMPT is enabled and the platform has unsynchronized ITCs and the calling task migrates to another CPU while doing the udelay loop, then the effective delay may be too short or very, very long. This patch disables preemption around 100 usec chunks of the overall desired udelay time. This minimizes preemption-holdoffs. udelay() is now too big to be inline, move it out of line and export it. Signed-off-by: John Hawkes Signed-off-by: Tony Luck --- arch/ia64/kernel/time.c | 29 +++++++++++++++++++++++++++++ include/asm-ia64/delay.h | 10 +--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 5b7e736f3b4..028a2b95936 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -249,3 +249,32 @@ time_init (void) */ set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); } + +#define SMALLUSECS 100 + +void +udelay (unsigned long usecs) +{ + unsigned long start; + unsigned long cycles; + unsigned long smallusecs; + + /* + * Execute the non-preemptible delay loop (because the ITC might + * not be synchronized between CPUS) in relatively short time + * chunks, allowing preemption between the chunks. + */ + while (usecs > 0) { + smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs; + preempt_disable(); + cycles = smallusecs*local_cpu_data->cyc_per_usec; + start = ia64_get_itc(); + + while (ia64_get_itc() - start < cycles) + cpu_relax(); + + preempt_enable(); + usecs -= smallusecs; + } +} +EXPORT_SYMBOL(udelay); diff --git a/include/asm-ia64/delay.h b/include/asm-ia64/delay.h index 57182d6f2b9..bba70207639 100644 --- a/include/asm-ia64/delay.h +++ b/include/asm-ia64/delay.h @@ -84,14 +84,6 @@ __delay (unsigned long loops) ia64_delay_loop (loops - 1); } -static __inline__ void -udelay (unsigned long usecs) -{ - unsigned long start = ia64_get_itc(); - unsigned long cycles = usecs*local_cpu_data->cyc_per_usec; - - while (ia64_get_itc() - start < cycles) - cpu_relax(); -} +extern void udelay (unsigned long usecs); #endif /* _ASM_IA64_DELAY_H */ -- cgit v1.2.3 From 4d7672b46244abffea1953e55688c0ea143dd617 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 16 Dec 2005 10:21:23 -0800 Subject: Make sure we copy pages inserted with "vm_insert_page()" on fork The logic that decides that a fork() might be able to avoid copying a VM area when it can be re-created by page faults didn't know about the new vm_insert_page() case. Also make some things a bit more anal wrt VM_PFNMAP. Pointed out by Hugh Dickins Signed-off-by: Linus Torvalds --- include/linux/mm.h | 1 + mm/memory.c | 3 ++- mm/mmap.c | 2 +- mm/mremap.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index e5677f45674..a06a84d347f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -163,6 +163,7 @@ extern unsigned int kobjsize(const void *objp); #define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ #define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ #define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ +#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS diff --git a/mm/memory.c b/mm/memory.c index d22f78c8a38..d8dde07a365 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -574,7 +574,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, * readonly mappings. The tradeoff is that copy_page_range is more * efficient than faulting. */ - if (!(vma->vm_flags & (VM_HUGETLB|VM_NONLINEAR|VM_PFNMAP))) { + if (!(vma->vm_flags & (VM_HUGETLB|VM_NONLINEAR|VM_PFNMAP|VM_INSERTPAGE))) { if (!vma->anon_vma) return 0; } @@ -1228,6 +1228,7 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned long addr, struct page * return -EFAULT; if (!page_count(page)) return -EINVAL; + vma->vm_flags |= VM_INSERTPAGE; return insert_page(vma->vm_mm, addr, page, vma->vm_page_prot); } EXPORT_SYMBOL(vm_insert_page); diff --git a/mm/mmap.c b/mm/mmap.c index 11ca5927d5f..64ba4dbcb7d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -611,7 +611,7 @@ again: remove_next = 1 + (end > next->vm_end); * If the vma has a ->close operation then the driver probably needs to release * per-vma resources, so we don't attempt to merge those. */ -#define VM_SPECIAL (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) +#define VM_SPECIAL (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) static inline int is_mergeable_vma(struct vm_area_struct *vma, struct file *file, unsigned long vm_flags) diff --git a/mm/mremap.c b/mm/mremap.c index b535438c363..ddaeee9a0b6 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -323,7 +323,7 @@ unsigned long do_mremap(unsigned long addr, /* We can't remap across vm area boundaries */ if (old_len > vma->vm_end - addr) goto out; - if (vma->vm_flags & VM_DONTEXPAND) { + if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP)) { if (new_len > old_len) goto out; } -- cgit v1.2.3 From 3bd7f01713f30e7c616ab975ebb84ab7eb58a60a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 16 Dec 2005 11:00:03 -0500 Subject: [IA64] uncached ref count leak Use raw_smp_processor_id() instead of get_cpu() as we don't need the extra features of get_cpu(). Signed-off-by: Jes Sorensen Signed-off-by: Tony Luck --- arch/ia64/kernel/uncached.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index c6d40446c2c..b631cf86ed4 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c @@ -53,7 +53,7 @@ static void uncached_ipi_visibility(void *data) if ((status != PAL_VISIBILITY_OK) && (status != PAL_VISIBILITY_OK_REMOTE_NEEDED)) printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on " - "CPU %i\n", status, get_cpu()); + "CPU %i\n", status, raw_smp_processor_id()); } @@ -63,7 +63,7 @@ static void uncached_ipi_mc_drain(void *data) status = ia64_pal_mc_drain(); if (status) printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on " - "CPU %i\n", status, get_cpu()); + "CPU %i\n", status, raw_smp_processor_id()); } @@ -105,7 +105,7 @@ uncached_get_new_chunk(struct gen_pool *poolp) status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); dprintk(KERN_INFO "pal_prefetch_visibility() returns %i on cpu %i\n", - status, get_cpu()); + status, raw_smp_processor_id()); if (!status) { status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1); -- cgit v1.2.3 From d74700e604db717eef7a3112176e6350fb00d0e3 Mon Sep 17 00:00:00 2001 From: Jack Steiner Date: Thu, 15 Dec 2005 12:41:22 -0600 Subject: [IA64-SGI] Missed TLB flush I see why the problem exists only on SN. SN uses a different hardware mechanism to purge TLB entries across nodes. It looks like there is a bug in the SN TLB flushing code. During context switch, kernel threads inherit the mm of the task that was previously running on the cpu. This confuses the code in sn2_global_tlb_purge(). The result is a missed TLB purge for the task that owns the "borrowed" mm. (I hit the problem running heavy stress where kswapd was purging code pages of a user task that woke kswapd. The user task took a SIGILL fault trying to execute code in the page that had been ripped out from underneath it). Signed-off-by: Jack Steiner Signed-off-by: Tony Luck --- arch/ia64/sn/kernel/sn2/sn2_smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c index 5d54f5f4e92..471bbaa65d1 100644 --- a/arch/ia64/sn/kernel/sn2/sn2_smp.c +++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c @@ -202,7 +202,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start, unsigned long end, unsigned long nbits) { int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0; - int mymm = (mm == current->active_mm); + int mymm = (mm == current->active_mm && current->mm); volatile unsigned long *ptc0, *ptc1; unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value; short nasids[MAX_NUMNODES], nix; -- cgit v1.2.3 From d5bf3165b6fbb879a4658f9da9ca2fe002b75f08 Mon Sep 17 00:00:00 2001 From: "hawkes@sgi.com" Date: Tue, 13 Dec 2005 13:45:44 -0800 Subject: [IA64-SGI] change default_sn2 to NR_CPUS==1024 Change the NR_CPUS default for ia64/sn up to 1024. Signed-off-by: John Hawkes Signed-off-by: John Hesterberg Signed-off-by: Tony Luck --- arch/ia64/configs/sn2_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig index e1924cc9687..ff8bb3770c9 100644 --- a/arch/ia64/configs/sn2_defconfig +++ b/arch/ia64/configs/sn2_defconfig @@ -113,7 +113,7 @@ CONFIG_IOSAPIC=y CONFIG_IA64_SGI_SN_XP=m CONFIG_FORCE_MAX_ZONEORDER=17 CONFIG_SMP=y -CONFIG_NR_CPUS=512 +CONFIG_NR_CPUS=1024 # CONFIG_HOTPLUG_CPU is not set CONFIG_SCHED_SMT=y CONFIG_PREEMPT=y -- cgit v1.2.3 From dc86e88c2bb8a7603ee175fbb6a9e92cf3293dd8 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Mon, 12 Dec 2005 09:34:32 -0800 Subject: [IA64] Add __read_mostly support for IA64 sparc64, i386 and x86_64 have support for a special data section dedicated to rarely updated data that is frequently read. The section was created to avoid false sharing of those rarely read data with frequently written kernel data. This patch creates such a data section for ia64 and will group rarely written data into this section. Signed-off-by: Christoph Lameter Signed-off-by: Tony Luck --- arch/ia64/kernel/vmlinux.lds.S | 3 +++ include/linux/cache.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 30d8564e960..73af6267d2e 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -177,6 +177,9 @@ SECTIONS } . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose kernel data */ + .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) + { *(.data.read_mostly) } + .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { *(.data.cacheline_aligned) } diff --git a/include/linux/cache.h b/include/linux/cache.h index f6b5a46c5f8..0b7ecf3af78 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -13,7 +13,7 @@ #define SMP_CACHE_BYTES L1_CACHE_BYTES #endif -#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) +#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) #define __read_mostly __attribute__((__section__(".data.read_mostly"))) #else #define __read_mostly -- cgit v1.2.3 From dfded4ae71080b53798c7bbf4628a9b22d1e3e8b Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Fri, 16 Dec 2005 11:08:43 -0800 Subject: [PATCH] i2c: Fix i2c-mv64xxx compilation error The busses/i2c-mv64xxx.c driver doesn't currently compile because of an incorrect argument to dev_err(). This patch fixes that. Signed-off-by: Mark A. Greer Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/i2c/busses/i2c-mv64xxx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index afd7634e5cc..81031eb5105 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -529,14 +529,15 @@ mv64xxx_i2c_probe(struct platform_device *pd) i2c_set_adapdata(&drv_data->adapter, drv_data); if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, - MV64XXX_I2C_CTLR_NAME, drv_data)) { - - dev_err(dev, "mv64xxx: Can't register intr handler " - "irq: %d\n", drv_data->irq); + MV64XXX_I2C_CTLR_NAME, drv_data)) { + dev_err(&drv_data->adapter.dev, + "mv64xxx: Can't register intr handler irq: %d\n", + drv_data->irq); rc = -EINVAL; goto exit_unmap_regs; } else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) { - dev_err(dev, "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc); + dev_err(&drv_data->adapter.dev, + "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc); goto exit_free_irq; } -- cgit v1.2.3 From 52f975ea21e28871a371c2d941e13d64c9f8cd66 Mon Sep 17 00:00:00 2001 From: Milton Miller Date: Fri, 16 Dec 2005 11:08:48 -0800 Subject: [PATCH] PCI express must be initialized before PCI hotplug PCI express hotplug uses the pcieportbus driver so pcie must be initialized before hotplug/. This patch changes the link order. Signed-Off-By: Milton Miller Acked-by: Anton Blanchard Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/pci/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 716df015f8d..6707df96893 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -6,6 +6,9 @@ obj-y += access.o bus.o probe.o remove.o pci.o quirks.o \ pci-driver.o search.o pci-sysfs.o rom.o setup-res.o obj-$(CONFIG_PROC_FS) += proc.o +# Build PCI Express stuff if needed +obj-$(CONFIG_PCIEPORTBUS) += pcie/ + obj-$(CONFIG_HOTPLUG) += hotplug.o # Build the PCI Hotplug drivers if we were asked to @@ -40,7 +43,3 @@ endif ifeq ($(CONFIG_PCI_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif - -# Build PCI Express stuff if needed -obj-$(CONFIG_PCIEPORTBUS) += pcie/ - -- cgit v1.2.3 From 42f3ab42875a52af7e711803bfb8d8d7cca84c1c Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Fri, 16 Dec 2005 11:08:55 -0800 Subject: [PATCH] PCI: Fix dumb bug in mmconfig fix Use correct address when referencing mmconfig aperture while checking for broken MCFG. This was a typo when porting the code from 64bit to 32bit. It caused oopses at boot on some ThinkPads. Should definitely go into 2.6.15. Signed-off-by: Andi Kleen Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- arch/i386/pci/mmconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 70a9cc132cf..4bb4d4b0f73 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c @@ -155,7 +155,7 @@ static __init void unreachable_devices(void) addr = get_base_addr(0, 0, PCI_DEVFN(i, 0)); if (addr != 0) pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0)); - if (addr == 0 || readl((u32 __iomem *)addr) != val1) + if (addr == 0 || readl((u32 __iomem *)mmcfg_virt_addr) != val1) set_bit(i, fallback_slots); spin_unlock_irqrestore(&pci_config_lock, flags); } -- cgit v1.2.3 From 42245e65f356ed54fdf7a1f9a0095e0bc40f73a3 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 16 Dec 2005 11:09:01 -0800 Subject: [PATCH] UHCI: add missing memory barriers This patch (as617) adds a couple of memory barriers that Ben H. forgot in his recent suspend/resume fix. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/host/uhci-hcd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index ed550132db0..79efaf7d86a 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -717,6 +717,7 @@ static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message) * at the source, so we must turn off PIRQ. */ pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0); + mb(); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); uhci->hc_inaccessible = 1; hcd->poll_rh = 0; @@ -738,6 +739,7 @@ static int uhci_resume(struct usb_hcd *hcd) * really don't want to keep a stale HCD_FLAG_HW_ACCESSIBLE=0 */ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + mb(); if (uhci->rh_state == UHCI_RH_RESET) /* Dead */ return 0; -- cgit v1.2.3 From a78719c387cc25ed97304a235a20c24f0f89399b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 16 Dec 2005 22:35:28 +0000 Subject: [PATCH] ppc: booke_wdt compile fix booke_wdt.c had been missed in cpu_specs[] removal sweep Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- drivers/char/watchdog/booke_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index c800cce73c1..b6640606b44 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c @@ -173,7 +173,7 @@ static int __init booke_wdt_init(void) int ret = 0; printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); - ident.firmware_version = cpu_specs[0].pvr_value; + ident.firmware_version = cur_cpu_spec->pvr_value; ret = misc_register(&booke_wdt_miscdev); if (ret) { -- cgit v1.2.3 From 7c3dbbe982ac85837f1da150ea9539a9e9a12557 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 16 Dec 2005 22:35:23 +0000 Subject: [PATCH] ppc: ppc4xx_dma DMA_MODE_{READ,WRITE} fix DMA_MODE_{READ,WRITE} are declared in asm-powerpc/dma.h and their declarations there match the definitions. Old declarations in ppc4xx_dma.h are not right anymore (wrong type, to start with). Killed them, added include of asm/dma.h where needed. Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- arch/ppc/syslib/ppc4xx_dma.c | 1 + include/asm-ppc/ppc4xx_dma.h | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/ppc/syslib/ppc4xx_dma.c b/arch/ppc/syslib/ppc4xx_dma.c index f15e64285f9..05ccd598dd4 100644 --- a/arch/ppc/syslib/ppc4xx_dma.c +++ b/arch/ppc/syslib/ppc4xx_dma.c @@ -30,6 +30,7 @@ #include #include +#include #include ppc_dma_ch_t dma_channels[MAX_PPC4xx_DMA_CHANNELS]; diff --git a/include/asm-ppc/ppc4xx_dma.h b/include/asm-ppc/ppc4xx_dma.h index a415001165f..46a086fff81 100644 --- a/include/asm-ppc/ppc4xx_dma.h +++ b/include/asm-ppc/ppc4xx_dma.h @@ -33,9 +33,6 @@ #define MAX_PPC4xx_DMA_CHANNELS 4 -/* in arch/ppc/kernel/setup.c -- Cort */ -extern unsigned long DMA_MODE_WRITE, DMA_MODE_READ; - /* * Function return status codes * These values are used to indicate whether or not the function -- cgit v1.2.3 From 567bd98017d9c9f2ac1c148ddc78c062e8abd398 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 17 Dec 2005 15:25:42 +0000 Subject: [ARM] Fix sys_sendto and sys_recvfrom 6-arg syscalls Rather than providing more wrappers for 6-arg syscalls, arrange for them to be supported as standard. This just means that we always store the 6th argument on the stack, rather than in the wrappers. This means we eliminate the wrappers for: * sys_futex * sys_arm_fadvise64_64 * sys_mbind * sys_ipc Signed-off-by: Russell King --- arch/arm/kernel/calls.S | 8 ++++---- arch/arm/kernel/entry-common.S | 20 ++------------------ 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 2ad4aa2a153..55076a75e5b 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S @@ -131,7 +131,7 @@ __syscall_start: .long sys_wait4 /* 115 */ .long sys_swapoff .long sys_sysinfo - .long sys_ipc_wrapper + .long sys_ipc .long sys_fsync .long sys_sigreturn_wrapper /* 120 */ .long sys_clone_wrapper @@ -254,7 +254,7 @@ __syscall_start: .long sys_fremovexattr .long sys_tkill .long sys_sendfile64 -/* 240 */ .long sys_futex_wrapper +/* 240 */ .long sys_futex .long sys_sched_setaffinity .long sys_sched_getaffinity .long sys_io_setup @@ -284,7 +284,7 @@ __syscall_start: .long sys_fstatfs64 .long sys_tgkill .long sys_utimes -/* 270 */ .long sys_arm_fadvise64_64_wrapper +/* 270 */ .long sys_arm_fadvise64_64 .long sys_pciconfig_iobase .long sys_pciconfig_read .long sys_pciconfig_write @@ -333,7 +333,7 @@ __syscall_start: .long sys_inotify_init .long sys_inotify_add_watch .long sys_inotify_rm_watch - .long sys_mbind_wrapper + .long sys_mbind /* 320 */ .long sys_get_mempolicy .long sys_set_mempolicy __syscall_end: diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index f7f18307523..e2b42997ad3 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -145,7 +145,7 @@ ENTRY(vector_swi) #endif enable_irq - str r4, [sp, #-S_OFF]! @ push fifth arg + stmdb sp!, {r4, r5} @ push fifth and sixth args get_thread_info tsk ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing @@ -204,7 +204,7 @@ ENTRY(sys_call_table) * Special system call wrappers */ @ r0 = syscall number -@ r5 = syscall table +@ r8 = syscall table .type sys_syscall, #function sys_syscall: eor scno, r0, #__NR_SYSCALL_BASE @@ -255,22 +255,6 @@ sys_sigaltstack_wrapper: ldr r2, [sp, #S_OFF + S_SP] b do_sigaltstack -sys_futex_wrapper: - str r5, [sp, #4] @ push sixth arg - b sys_futex - -sys_arm_fadvise64_64_wrapper: - str r5, [sp, #4] @ push r5 to stack - b sys_arm_fadvise64_64 - -sys_mbind_wrapper: - str r5, [sp, #4] - b sys_mbind - -sys_ipc_wrapper: - str r5, [sp, #4] @ push sixth arg - b sys_ipc - /* * Note: off_4k (r5) is always units of 4K. If we can't do the requested * offset, we return EINVAL. -- cgit v1.2.3 From 863a930a40eb7f2d18534c2c166b22582f5c6cfd Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 15 Dec 2005 20:01:43 -0800 Subject: [SCSI] fix scsi_reap_target() device_del from atomic context scsi_reap_target() was desgined to be called from any context. However it must do a device_del() of the target device, which may only be called from user context. Thus we have to reimplement scsi_reap_target() via a workqueue. Signed-off-by: James Bottomley --- drivers/scsi/scsi_scan.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 94e5167f260..e36c21e06d3 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -400,6 +400,35 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, return found_target; } +struct work_queue_wrapper { + struct work_struct work; + struct scsi_target *starget; +}; + +static void scsi_target_reap_work(void *data) { + struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data; + struct scsi_target *starget = wqw->starget; + struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); + unsigned long flags; + + kfree(wqw); + + spin_lock_irqsave(shost->host_lock, flags); + + if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { + list_del_init(&starget->siblings); + spin_unlock_irqrestore(shost->host_lock, flags); + device_del(&starget->dev); + transport_unregister_device(&starget->dev); + put_device(&starget->dev); + return; + + } + spin_unlock_irqrestore(shost->host_lock, flags); + + return; +} + /** * scsi_target_reap - check to see if target is in use and destroy if not * @@ -411,19 +440,18 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, */ void scsi_target_reap(struct scsi_target *starget) { - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - unsigned long flags; - spin_lock_irqsave(shost->host_lock, flags); + struct work_queue_wrapper *wqw = + kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC); - if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { - list_del_init(&starget->siblings); - spin_unlock_irqrestore(shost->host_lock, flags); - device_del(&starget->dev); - transport_unregister_device(&starget->dev); - put_device(&starget->dev); + if (!wqw) { + starget_printk(KERN_ERR, starget, + "Failed to allocate memory in scsi_reap_target()\n"); return; } - spin_unlock_irqrestore(shost->host_lock, flags); + + INIT_WORK(&wqw->work, scsi_target_reap_work, wqw); + wqw->starget = starget; + schedule_work(&wqw->work); } /** -- cgit v1.2.3 From 87d47d0547631e059c308b392cd2423fe9248c93 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Sat, 17 Dec 2005 18:39:23 -0800 Subject: [PATCH] i2o: Do not disable pci device when it's in use When dpt_i2o is loaded first, i2o being loaded would cause it to call pci_device_disable, thus breaking dpt_i2o's use of the device. Based on similar usage of pci_disable_device in other drivers. Signed-off-by: Ben Collins Signed-off-by: Linus Torvalds --- drivers/message/i2o/pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index 81ef306cb12..ee7075fa1ec 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c @@ -303,6 +303,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, struct i2o_controller *c; int rc; struct pci_dev *i960 = NULL; + int pci_dev_busy = 0; printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); @@ -395,6 +396,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, if ((rc = i2o_pci_alloc(c))) { printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " " failed\n", c->name); + if (rc == -ENODEV) + pci_dev_busy = 1; goto free_controller; } @@ -425,7 +428,8 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, i2o_iop_free(c); disable: - pci_disable_device(pdev); + if (!pci_dev_busy) + pci_disable_device(pdev); return rc; } -- cgit v1.2.3 From e5508c13ac25b07585229b144a45cf64a990171e Mon Sep 17 00:00:00 2001 From: "Salyzyn, Mark" Date: Sat, 17 Dec 2005 19:26:30 -0800 Subject: [PATCH] dpt_i2o fix for deadlock condition Miquel van Smoorenburg forwarded me this fix to resolve a deadlock condition that occurs due to the API change in 2.6.13+ kernels dropping the host locking when entering the error handling. They all end up calling adpt_i2o_post_wait(), which if you call it unlocked, might return with host_lock locked anyway and that causes a deadlock. Signed-off-by: Mark Salyzyn Cc: James Bottomley Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/scsi/dpt_i2o.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 418fc7b896a..6252b9ddc01 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -660,7 +660,12 @@ static int adpt_abort(struct scsi_cmnd * cmd) msg[2] = 0; msg[3]= 0; msg[4] = (u32)cmd; - if( (rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER)) != 0){ + if (pHba->host) + spin_lock_irq(pHba->host->host_lock); + rcode = adpt_i2o_post_wait(pHba, msg, sizeof(msg), FOREVER); + if (pHba->host) + spin_unlock_irq(pHba->host->host_lock); + if (rcode != 0) { if(rcode == -EOPNOTSUPP ){ printk(KERN_INFO"%s: Abort cmd not supported\n",pHba->name); return FAILED; @@ -697,10 +702,15 @@ static int adpt_device_reset(struct scsi_cmnd* cmd) msg[2] = 0; msg[3] = 0; + if (pHba->host) + spin_lock_irq(pHba->host->host_lock); old_state = d->state; d->state |= DPTI_DEV_RESET; - if( (rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER)) ){ - d->state = old_state; + rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER); + d->state = old_state; + if (pHba->host) + spin_unlock_irq(pHba->host->host_lock); + if (rcode != 0) { if(rcode == -EOPNOTSUPP ){ printk(KERN_INFO"%s: Device reset not supported\n",pHba->name); return FAILED; @@ -708,7 +718,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd) printk(KERN_INFO"%s: Device reset failed\n",pHba->name); return FAILED; } else { - d->state = old_state; printk(KERN_INFO"%s: Device reset successful\n",pHba->name); return SUCCESS; } @@ -721,6 +730,7 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd) { adpt_hba* pHba; u32 msg[4]; + u32 rcode; pHba = (adpt_hba*)cmd->device->host->hostdata[0]; memset(msg, 0, sizeof(msg)); @@ -729,7 +739,12 @@ static int adpt_bus_reset(struct scsi_cmnd* cmd) msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid); msg[2] = 0; msg[3] = 0; - if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){ + if (pHba->host) + spin_lock_irq(pHba->host->host_lock); + rcode = adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER); + if (pHba->host) + spin_unlock_irq(pHba->host->host_lock); + if (rcode != 0) { printk(KERN_WARNING"%s: Bus reset failed.\n",pHba->name); return FAILED; } else { -- cgit v1.2.3 From 9ce7677cfd7cd871adb457c80bea3b581b839641 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 18 Dec 2005 17:50:32 +0100 Subject: [PATCH] uml: arch/um/scripts/Makefile.rules - remove duplicated code Duplicated code - the patch adding it was probably applied twice without enough care. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/scripts/Makefile.rules | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules index b3fbf125709..2e41cabd3d9 100644 --- a/arch/um/scripts/Makefile.rules +++ b/arch/um/scripts/Makefile.rules @@ -21,11 +21,6 @@ define unprofile endef -# The stubs and unmap.o can't try to call mcount or update basic block data -define unprofile - $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1))) -endef - # cmd_make_link checks to see if the $(foo-dir) variable starts with a /. If # so, it's considered to be a path relative to $(srcdir) rather than # $(srcdir)/arch/$(SUBARCH). This is because x86_64 wants to get ldt.c from -- cgit v1.2.3 From 53c0b59dcdb7c68c3cfd4b9a0bd17373b785f2eb Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 18 Dec 2005 17:50:35 +0100 Subject: [PATCH] uml: fix dynamic linking on some 64-bit distros With Paolo 'Blaisorblade' Giarrusso The current UML build assumes that on x86-64 systems, /lib is a symlink to /lib64, but in some distributions (like PLD and CentOS) they are separate directories, so the 64 bit library loader isn't found. This patch inserts /lib64 at the start of the rpath on x86-64 UML builds. Signed-off-by: Rob Landley Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/Makefile-x86_64 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64 index 4f118d5cc2e..38df311e75d 100644 --- a/arch/um/Makefile-x86_64 +++ b/arch/um/Makefile-x86_64 @@ -12,3 +12,7 @@ CHECKFLAGS += -m64 ELF_ARCH := i386:x86-64 ELF_FORMAT := elf64-x86-64 + +# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example. + +LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 -- cgit v1.2.3 From 76c842d8f8096e2c98ff9ebe1db861363ff254e5 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Sun, 18 Dec 2005 17:50:37 +0100 Subject: [PATCH] uml - fix some funkiness in Kconfig So you may have seen the miniconfig stuff wander by, which means that my build script exits if there's a .config error, and we have this: fs/Kconfig:1749:warning: 'select' used by config symbol 'CIFS_UPCALL' refer to undefined symbol 'CONNECTOR' This makes it shut up. Signed-off-by: Rob Landley [ Verified it makes sense. ] Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 563301fe5df..1eb21de9d1b 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig @@ -289,6 +289,8 @@ source "arch/um/Kconfig.net" source "drivers/net/Kconfig" +source "drivers/connector/Kconfig" + source "fs/Kconfig" source "security/Kconfig" -- cgit v1.2.3 From 5b7b15afee89d6940482259b54d0864b7b2302b0 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Sun, 18 Dec 2005 17:50:39 +0100 Subject: [PATCH] uml skas0: stop gcc's insanity With Paolo 'Blaisorblade' Giarrusso UML skas0 stub has been miscompiling for many people (incidentally not the authors), depending on the used GCC versions. I think (and testing on some GCC versions shows) this patch avoids the fundamental issue which is behind this, namely gcc using the stack when we have just replaced it, behind gcc's back. The remapping and storage of the return value is hidden in a blob of asm, hopefully giving gcc no room for creativity. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/include/sysdep-i386/stub.h | 29 ++++++++++++++++------------- arch/um/include/sysdep-x86_64/stub.h | 30 +++++++++++++++++------------- arch/um/kernel/skas/clone.c | 23 +++++++++++++---------- 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h index 6ba8cbbe0d3..b492b12b4a1 100644 --- a/arch/um/include/sysdep-i386/stub.h +++ b/arch/um/include/sysdep-i386/stub.h @@ -6,8 +6,12 @@ #ifndef __SYSDEP_STUB_H #define __SYSDEP_STUB_H +#include #include #include +#include "stub-data.h" +#include "kern_constants.h" +#include "uml-config.h" extern void stub_segv_handler(int sig); extern void stub_clone_handler(void); @@ -76,23 +80,22 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3, return ret; } -static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6) +static inline void trap_myself(void) { - long ret; - - __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; " - "int $0x80 ; pop %%ebp" - : "=a" (ret) - : "g" (syscall), "b" (arg1), "c" (arg2), "d" (arg3), - "S" (arg4), "D" (arg5), "0" (arg6)); - - return ret; + __asm("int3"); } -static inline void trap_myself(void) +static inline void remap_stack(int fd, unsigned long offset) { - __asm("int3"); + __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" + "movl %7, %%ebx ; movl %%eax, (%%ebx)" + : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA), + "c" (UM_KERN_PAGE_SIZE), + "d" (PROT_READ | PROT_WRITE), + "S" (MAP_FIXED | MAP_SHARED), "D" (fd), + "a" (offset), + "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) + : "memory"); } #endif diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h index c41689c13dc..92e989f8176 100644 --- a/arch/um/include/sysdep-x86_64/stub.h +++ b/arch/um/include/sysdep-x86_64/stub.h @@ -6,8 +6,12 @@ #ifndef __SYSDEP_STUB_H #define __SYSDEP_STUB_H +#include #include #include +#include "stub-data.h" +#include "kern_constants.h" +#include "uml-config.h" extern void stub_segv_handler(int sig); extern void stub_clone_handler(void); @@ -81,23 +85,23 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3, return ret; } -static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6) +static inline void trap_myself(void) { - long ret; - - __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " - "movq %7, %%r9; " __syscall : "=a" (ret) - : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3), - "g" (arg4), "g" (arg5), "g" (arg6) - : __syscall_clobber, "r10", "r8", "r9" ); - - return ret; + __asm("int3"); } -static inline void trap_myself(void) +static inline void remap_stack(long fd, unsigned long offset) { - __asm("int3"); + __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " + "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; " + "movq %%rax, (%%rbx)": + : "a" (STUB_MMAP_NR), "D" (UML_CONFIG_STUB_DATA), + "S" (UM_KERN_PAGE_SIZE), + "d" (PROT_READ | PROT_WRITE), + "g" (MAP_FIXED | MAP_SHARED), "g" (fd), + "g" (offset), + "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) + : __syscall_clobber, "r10", "r8", "r9" ); } #endif diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c index cb37ce9124a..47b812b3bca 100644 --- a/arch/um/kernel/skas/clone.c +++ b/arch/um/kernel/skas/clone.c @@ -18,11 +18,10 @@ * on some systems. */ -#define STUB_DATA(field) (((struct stub_data *) UML_CONFIG_STUB_DATA)->field) - void __attribute__ ((__section__ (".__syscall_stub"))) stub_clone_handler(void) { + struct stub_data *data = (struct stub_data *) UML_CONFIG_STUB_DATA; long err; err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, @@ -35,17 +34,21 @@ stub_clone_handler(void) if(err) goto out; - err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL, - (long) &STUB_DATA(timer), 0); + err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL, + (long) &data->timer, 0); if(err) goto out; - err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA, - UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_FIXED | MAP_SHARED, STUB_DATA(fd), - STUB_DATA(offset)); + remap_stack(data->fd, data->offset); + goto done; + out: - /* save current result. Parent: pid; child: retcode of mmap */ - STUB_DATA(err) = err; + /* save current result. + * Parent: pid; + * child: retcode of mmap already saved and it jumps around this + * assignment + */ + data->err = err; + done: trap_myself(); } -- cgit v1.2.3 From ff60dde9e46b87757d5e83bd58be0688fca8e816 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sat, 17 Dec 2005 11:42:54 -0500 Subject: [PATCH] Input: fix an OOPS in HID driver This patch fixes an OOPS in HID driver when connecting simulation devices generating unknown simulation events. Signed-off-by: Dmitry Torokhov Acked-by: Vojtech Pavlik Signed-off-by: Linus Torvalds --- drivers/usb/input/hid-input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 9ff25eb520a..1220a5004a5 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -137,6 +137,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel switch (usage->hid & 0xffff) { case 0xba: map_abs(ABS_RUDDER); break; case 0xbb: map_abs(ABS_THROTTLE); break; + default: goto ignore; } break; -- cgit v1.2.3 From ee219e5e7c12b742243a080e2d8d288a48a32e44 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 17 Dec 2005 23:20:55 +0100 Subject: [PATCH] radeon drm: fix compilation breakage with gcc 2.95.3 Fix a typo which breaks radeon drm compilation with gcc 2.95.3. The offending line was added back in 2.6.11-rc3, but was harmless back then. A recent addition nearby changed it into a compilation breaker: commit 281ab031a8c9e5b593142eb4ec59a87faae8676a. The doubled semi-colon ends up being an empty instruction, and the variable declaration thus ends up being in the middle of "code". Signed-off-by: Jean Delvare Cc: Benjamin Herrenschmidt Cc: Mark M. Hoffman Cc: Paul Mackerras Signed-off-by: Linus Torvalds --- drivers/char/drm/radeon_cp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 95ae9e0892a..501e557cbc8 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c @@ -1311,7 +1311,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) { - drm_radeon_private_t *dev_priv = dev->dev_private;; + drm_radeon_private_t *dev_priv = dev->dev_private; unsigned int mem_size; DRM_DEBUG("\n"); -- cgit v1.2.3 From 37b1cc3910f7976369fc0ed55068a686e92555e6 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Fri, 16 Dec 2005 11:17:29 +0900 Subject: [PATCH] mtd onenand driver: check correct manufacturer This (and the three subsequent patches) is working well on OMAP H4 with 2.6.15-rc4 kernel and passes the LTP fs test. Signed-off-by: Linus Torvalds --- drivers/mtd/onenand/onenand_base.c | 16 ++++++++++------ include/linux/mtd/onenand.h | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index f67d5d6eb9a..33d6f5c2e05 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -1346,7 +1346,6 @@ static void onenand_print_device_info(int device) static const struct onenand_manufacturers onenand_manuf_ids[] = { {ONENAND_MFR_SAMSUNG, "Samsung"}, - {ONENAND_MFR_UNKNOWN, "Unknown"} }; /** @@ -1357,17 +1356,22 @@ static const struct onenand_manufacturers onenand_manuf_ids[] = { */ static int onenand_check_maf(int manuf) { + int size = ARRAY_SIZE(onenand_manuf_ids); + char *name; int i; - for (i = 0; onenand_manuf_ids[i].id; i++) { + for (i = 0; i < size; i++) if (manuf == onenand_manuf_ids[i].id) break; - } - printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", - onenand_manuf_ids[i].name, manuf); + if (i < size) + name = onenand_manuf_ids[i].name; + else + name = "Unknown"; + + printk(KERN_DEBUG "OneNAND Manufacturer: %s (0x%0x)\n", name, manuf); - return (i != ONENAND_MFR_UNKNOWN); + return (i == size); } /** diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index f1fd4215686..53423d3b43b 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h @@ -140,7 +140,6 @@ struct onenand_chip { * OneNAND Flash Manufacturer ID Codes */ #define ONENAND_MFR_SAMSUNG 0xec -#define ONENAND_MFR_UNKNOWN 0x00 /** * struct nand_manufacturers - NAND Flash Manufacturer ID Structure -- cgit v1.2.3 From 20ba89a3614bbc5d111fd74375e14c577859b2a3 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Fri, 16 Dec 2005 11:17:29 +0900 Subject: [PATCH] mtd onenand driver: fix unlock problem in DDP --- drivers/mtd/onenand/onenand_base.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 33d6f5c2e05..d57afbaaedc 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -1296,6 +1296,12 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) /* Block lock scheme */ for (block = start; block < end; block++) { + /* Set block address */ + value = onenand_block_address(this, block); + this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1); + /* Select DataRAM for DDP */ + value = onenand_bufferram_address(this, block); + this->write_word(value, this->base + ONENAND_REG_START_ADDRESS2); /* Set start block address */ this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS); /* Write unlock command */ @@ -1309,10 +1315,6 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) & ONENAND_CTRL_ONGO) continue; - /* Set block address for read block status */ - value = onenand_block_address(this, block); - this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1); - /* Check lock status */ status = this->read_word(this->base + ONENAND_REG_WP_STATUS); if (!(status & ONENAND_WP_US)) -- cgit v1.2.3 From 532a37cf8d05dd1aa5631be836036204b0d2b4a1 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Fri, 16 Dec 2005 11:17:29 +0900 Subject: [PATCH] mtd onenand driver: reduce stack usage Signed-off-by: Linus Torvalds --- drivers/mtd/onenand/onenand_base.c | 27 ++++++++++++++++++++++++--- drivers/mtd/onenand/onenand_bbt.c | 4 ++-- include/linux/mtd/onenand.h | 4 ++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index d57afbaaedc..a53a73fc2a5 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -940,7 +940,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, u_char *eccbuf, struct nand_oobinfo *oobsel) { struct onenand_chip *this = mtd->priv; - unsigned char buffer[MAX_ONENAND_PAGESIZE], *pbuf; + unsigned char *pbuf; size_t total_len, len; int i, written = 0; int ret = 0; @@ -975,7 +975,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, /* Loop until all keve's data has been written */ len = 0; while (count) { - pbuf = buffer; + pbuf = this->page_buf; /* * If the given tuple is >= pagesize then * write it out from the iov @@ -995,7 +995,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, int cnt = 0, thislen; while (cnt < mtd->oobblock) { thislen = min_t(int, mtd->oobblock - cnt, vecs->iov_len - len); - memcpy(buffer + cnt, vecs->iov_base + len, thislen); + memcpy(this->page_buf + cnt, vecs->iov_base + len, thislen); cnt += thislen; len += thislen; @@ -1519,6 +1519,18 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) this->read_bufferram = onenand_sync_read_bufferram; } + /* Allocate buffers, if necessary */ + if (!this->page_buf) { + size_t len; + len = mtd->oobblock + mtd->oobsize; + this->page_buf = kmalloc(len, GFP_KERNEL); + if (!this->page_buf) { + printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); + return -ENOMEM; + } + this->options |= ONENAND_PAGEBUF_ALLOC; + } + this->state = FL_READY; init_waitqueue_head(&this->wq); spin_lock_init(&this->chip_lock); @@ -1580,12 +1592,21 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) */ void onenand_release(struct mtd_info *mtd) { + struct onenand_chip *this = mtd->priv; + #ifdef CONFIG_MTD_PARTITIONS /* Deregister partitions */ del_mtd_partitions (mtd); #endif /* Deregister the device */ del_mtd_device (mtd); + + /* Free bad block table memory, if allocated */ + if (this->bbm) + kfree(this->bbm); + /* Buffer allocated by onenand_scan */ + if (this->options & ONENAND_PAGEBUF_ALLOC) + kfree(this->page_buf); } EXPORT_SYMBOL_GPL(onenand_scan); diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index f40190f499e..4510d3361ea 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c @@ -118,10 +118,10 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr */ static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd) { - unsigned char data_buf[MAX_ONENAND_PAGESIZE]; + struct onenand_chip *this = mtd->priv; bd->options &= ~NAND_BBT_SCANEMPTY; - return create_bbt(mtd, data_buf, bd, -1); + return create_bbt(mtd, this->page_buf, bd, -1); } /** diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 53423d3b43b..7419b5fab13 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h @@ -17,7 +17,6 @@ #include #define MAX_BUFFERRAM 2 -#define MAX_ONENAND_PAGESIZE (2048 + 64) /* Scan and identify a OneNAND device */ extern int onenand_scan(struct mtd_info *mtd, int max_chips); @@ -110,6 +109,7 @@ struct onenand_chip { spinlock_t chip_lock; wait_queue_head_t wq; onenand_state_t state; + unsigned char *page_buf; struct nand_oobinfo *autooob; @@ -134,7 +134,7 @@ struct onenand_chip { * Options bits */ #define ONENAND_CONT_LOCK (0x0001) - +#define ONENAND_PAGEBUF_ALLOC (0x1000) /* * OneNAND Flash Manufacturer ID Codes -- cgit v1.2.3 From 27f4e0834746196f219e3e030ca71ffd3b176483 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Fri, 16 Dec 2005 11:17:29 +0900 Subject: [PATCH] mtd onenand driver: use platform_device.h instead device.h Signed-off-by: Linus Torvalds --- drivers/mtd/onenand/generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index 48cce431f89..45c077d0f06 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c @@ -12,9 +12,9 @@ * This is a device driver for the OneNAND flash for generic boards. */ -#include #include #include +#include #include #include #include @@ -39,7 +39,7 @@ static int __devinit generic_onenand_probe(struct device *dev) { struct onenand_info *info; struct platform_device *pdev = to_platform_device(dev); - struct onenand_platform_data *pdata = pdev->dev.platform_data; + struct flash_platform_data *pdata = pdev->dev.platform_data; struct resource *res = pdev->resource; unsigned long size = res->end - res->start + 1; int err; -- cgit v1.2.3 From df7addbb45874f0f992266003155de5a22e1872f Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 18 Dec 2005 16:36:54 -0800 Subject: Linux v2.6.15-rc6 Also renamed in honor of Portland being snowed in and everybody sliding around on the highways like greased pumpkins. Signed-off-by: Linus Torvalds --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad457e1bd0d..f4218b5db82 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 15 -EXTRAVERSION =-rc5 -NAME=Affluent Albatross +EXTRAVERSION =-rc6 +NAME=Sliding Snow Leopard # *DOCUMENTATION* # To see a list of typical targets execute "make help" -- cgit v1.2.3 From f85c657ff1f712abd5207a95fba8a5fcc282ab04 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 19 Dec 2005 08:53:59 -0200 Subject: [PATCH] V4L/DVB (3188): Fix compilation failure with gcc 2.95.3. - Fix compilation failure with gcc 2.95.3. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 6 +++--- drivers/media/video/em28xx/em28xx-i2c.c | 2 +- drivers/media/video/em28xx/em28xx-video.c | 2 +- drivers/media/video/em28xx/em28xx.h | 8 ++++---- drivers/media/video/saa7134/saa7134-alsa.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index ec11619f8ea..0cfe75416ec 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -39,7 +39,7 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); #define em28xx_coredbg(fmt, arg...) do {\ if (core_debug) \ printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__, ##arg); } while (0) + dev->name, __FUNCTION__ , ##arg); } while (0) static unsigned int reg_debug; module_param(reg_debug,int,0644); @@ -48,7 +48,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); #define em28xx_regdbg(fmt, arg...) do {\ if (reg_debug) \ printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__, ##arg); } while (0) + dev->name, __FUNCTION__ , ##arg); } while (0) static unsigned int isoc_debug; module_param(isoc_debug,int,0644); @@ -57,7 +57,7 @@ MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); #define em28xx_isocdbg(fmt, arg...) do {\ if (isoc_debug) \ printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__, ##arg); } while (0) + dev->name, __FUNCTION__ , ##arg); } while (0) static int alt = EM28XX_PINOUT; module_param(alt, int, 0644); diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 29e21ad187c..7f5603054f0 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -44,7 +44,7 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); printk(fmt, ##args); } while (0) #define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ printk(KERN_DEBUG "%s at %s: " fmt, \ - dev->name, __FUNCTION__, ##args); } while (0) + dev->name, __FUNCTION__ , ##args); } while (0) /* * em2800_i2c_send_max4() diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 8ecaa0803e0..06d76879bde 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -45,7 +45,7 @@ #define em28xx_videodbg(fmt, arg...) do {\ if (video_debug) \ printk(KERN_INFO "%s %s :"fmt, \ - dev->name, __FUNCTION__, ##arg); } while (0) + dev->name, __FUNCTION__ , ##arg); } while (0) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 1e2ee43db39..5c7a41ce69f 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -392,18 +392,18 @@ extern const unsigned int em28xx_bcount; /* printk macros */ #define em28xx_err(fmt, arg...) do {\ - printk(KERN_ERR fmt, ##arg); } while (0) + printk(KERN_ERR fmt , ##arg); } while (0) #define em28xx_errdev(fmt, arg...) do {\ printk(KERN_ERR "%s: "fmt,\ - dev->name, ##arg); } while (0) + dev->name , ##arg); } while (0) #define em28xx_info(fmt, arg...) do {\ printk(KERN_INFO "%s: "fmt,\ - dev->name, ##arg); } while (0) + dev->name , ##arg); } while (0) #define em28xx_warn(fmt, arg...) do {\ printk(KERN_WARNING "%s: "fmt,\ - dev->name, ##arg); } while (0) + dev->name , ##arg); } while (0) inline static int em28xx_audio_source(struct em28xx *dev, int input) { diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index b24a26b065c..953d5fec82d 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -60,7 +60,7 @@ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); #define dprintk(fmt, arg...) if (debug) \ - printk(KERN_DEBUG "%s/alsa: " fmt, dev->name, ## arg) + printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ##arg) -- cgit v1.2.3 From 3338761e6c52a8dee631dcc69129c625801ab132 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Mon, 19 Dec 2005 08:54:11 -0200 Subject: [PATCH] V4L/DVB (3180): Fix tuner 100 definition for hauppauge eeprom - Tuner 100 is the TUNER_PHILIPS_FMD1216ME_MK3, not TUNER_ABSENT. This was causing the tuner module to be skipped, and rendered boards with this value in the eeprom (like the HVR1100) unable to tune Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tveeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index cd7cf1bd12b..5ac235365dd 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -206,7 +206,7 @@ hauppauge_tuner[] = { TUNER_ABSENT, "TCL 2002MI_3H"}, { TUNER_TCL_2002N, "TCL 2002N 5H"}, /* 100-109 */ - { TUNER_ABSENT, "Philips FMD1216ME"}, + { TUNER_PHILIPS_FMD1216ME_MK3, "Philips FMD1216ME"}, { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, { TUNER_ABSENT, "Panasonic ENV57H12D5"}, { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05-4"}, -- cgit v1.2.3 From 60edb13759096097b7208843dc9b7582a7d14c61 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Mon, 19 Dec 2005 08:54:11 -0200 Subject: [PATCH] V4L/DVB (3181): Enable SPDIF output for DVB-S rev 2.3 - Enable SPDIF output for DVB-S rev 2.3. Firmware 2623 or higher required. Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ttpci/av7110.c | 3 +++ drivers/media/dvb/ttpci/av7110_hw.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 992be0be6b1..7dae91e5863 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -176,6 +176,9 @@ static void init_av7110_av(struct av7110 *av7110) } } + if (dev->pci->subsystem_vendor == 0x13c2 && dev->pci->subsystem_device == 0x000e) + av7110_fw_cmd(av7110, COMTYPE_AUDIODAC, SpdifSwitch, 1, 0); // SPDIF on + ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); if (ret < 0) printk("dvb-ttpci:cannot set volume :%d\n",ret); diff --git a/drivers/media/dvb/ttpci/av7110_hw.h b/drivers/media/dvb/ttpci/av7110_hw.h index fedd20f9815..2a5e87ba105 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.h +++ b/drivers/media/dvb/ttpci/av7110_hw.h @@ -143,7 +143,8 @@ enum av7110_audio_command { MainSwitch, ADSwitch, SendDiSEqC, - SetRegister + SetRegister, + SpdifSwitch }; enum av7110_request_command { -- cgit v1.2.3 From 468a0a54aabdac72e9c7bbd4f8372f1df2d9f0ae Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Dec 2005 08:54:11 -0200 Subject: [PATCH] V4L/DVB (3189): Fix a broken logic that didn't cover all standards. - Fix a broken logic that didn't cover all standards. - Fix compilation failure with gcc 2.95.3. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx25840/cx25840-core.c | 42 +++++++++++++++++------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index aea3f038cff..5b93723a176 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input) static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) { - u8 fmt; - - switch (std) { - /* zero is autodetect */ - case 0: fmt = 0x0; break; - /* default ntsc to ntsc-m */ - case V4L2_STD_NTSC: - case V4L2_STD_NTSC_M: fmt = 0x1; break; - case V4L2_STD_NTSC_M_JP: fmt = 0x2; break; - case V4L2_STD_NTSC_443: fmt = 0x3; break; - case V4L2_STD_PAL: fmt = 0x4; break; - case V4L2_STD_PAL_M: fmt = 0x5; break; - case V4L2_STD_PAL_N: fmt = 0x6; break; - case V4L2_STD_PAL_Nc: fmt = 0x7; break; - case V4L2_STD_PAL_60: fmt = 0x8; break; - case V4L2_STD_SECAM: fmt = 0xc; break; - default: - return -ERANGE; + u8 fmt=0; /* zero is autodetect */ + + /* First tests should be against specific std */ + if (std & V4L2_STD_NTSC_M_JP) { + fmt=0x2; + } else if (std & V4L2_STD_NTSC_443) { + fmt=0x3; + } else if (std & V4L2_STD_PAL_M) { + fmt=0x5; + } else if (std & V4L2_STD_PAL_N) { + fmt=0x6; + } else if (std & V4L2_STD_PAL_Nc) { + fmt=0x7; + } else if (std & V4L2_STD_PAL_60) { + fmt=0x8; + } else { + /* Then, test against generic ones */ + if (std & V4L2_STD_NTSC) { + fmt=0x1; + } else if (std & V4L2_STD_PAL) { + fmt=0x4; + } else if (std & V4L2_STD_SECAM) { + fmt=0xc; + } } cx25840_and_or(client, 0x400, ~0xf, fmt); -- cgit v1.2.3 From ecfa4fdca15c089e372095325d9e78264224aeb3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 19 Dec 2005 09:15:13 -0200 Subject: [PATCH] V4L/DVB SCM Maintainers Update - This patch updates MAINTAINERS file by replacing quilt to git SCM Signed-off-by: Mauro Carvalho Chehab --- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index da6973adacd..6af683025ae 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -536,7 +536,7 @@ P: Mauro Carvalho Chehab M: mchehab@brturbo.com.br L: video4linux-list@redhat.com W: http://linuxtv.org -T: quilt http://www.linuxtv.org/download/quilt/ +T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git S: Maintained BUSLOGIC SCSI DRIVER @@ -834,7 +834,7 @@ P: LinuxTV.org Project M: linux-dvb-maintainer@linuxtv.org L: linux-dvb@linuxtv.org (subscription required) W: http://linuxtv.org/ -T: quilt http://www.linuxtv.org/download/quilt/ +T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git S: Supported EATA-DMA SCSI DRIVER @@ -2896,7 +2896,7 @@ P: Mauro Carvalho Chehab M: mchehab@brturbo.com.br L: video4linux-list@redhat.com W: http://linuxtv.org -T: quilt http://www.linuxtv.org/download/quilt/ +T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git S: Maintained W1 DALLAS'S 1-WIRE BUS -- cgit v1.2.3 From 0476f171affa6eca62021fca2ae9f5140acc3713 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 19 Dec 2005 13:53:09 -0800 Subject: [NETFILTER]: Fix NAT init order As noticed by Phil Oester, the GRE NAT protocol helper is initialized before the NAT core, which makes registration fail. Change the linking order to make NAT be initialized first. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- net/ipv4/netfilter/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 058c48e258f..d0a447e520a 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile @@ -12,6 +12,7 @@ ip_nat_pptp-objs := ip_nat_helper_pptp.o ip_nat_proto_gre.o # connection tracking obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o +obj-$(CONFIG_IP_NF_NAT) += ip_nat.o # conntrack netlink interface obj-$(CONFIG_IP_NF_CONNTRACK_NETLINK) += ip_conntrack_netlink.o @@ -41,7 +42,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o # the three instances of ip_tables obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o -obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o ip_nat.o +obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o # matches -- cgit v1.2.3 From 31cb5bd4dc89ba14e6347b094e15a2f6778a01fc Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 19 Dec 2005 13:53:26 -0800 Subject: [NETFILTER]: Fix incorrect dependency for IP6_NF_TARGET_NFQUEUE IP6_NF_TARGET_NFQUEUE depends on IP6_NF_IPTABLES, not IP_NF_IPTABLES. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- net/ipv6/netfilter/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index 060d6120241..04912f9b35c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig @@ -211,7 +211,7 @@ config IP6_NF_TARGET_REJECT config IP6_NF_TARGET_NFQUEUE tristate "NFQUEUE Target Support" - depends on IP_NF_IPTABLES + depends on IP6_NF_IPTABLES help This Target replaced the old obsolete QUEUE target. -- cgit v1.2.3 From 6b80ebedbee87c5b2213fc3635bf0bd7450bce30 Mon Sep 17 00:00:00 2001 From: Kristian Slavov Date: Mon, 19 Dec 2005 13:54:44 -0800 Subject: [RTNETLINK]: Fix RTNLGRP definitions in rtnetlink.h I reported a problem and gave hints to the solution, but nobody seemed to react. So I prepared a patch against 2.6.14.4. Tested on 2.6.14.4 with "ip monitor addr" and with the program attached, while adding and removing IPv6 address. Both programs didn't receive any messages. Tested 2.6.14.4 + this patch, and both programs received add and remove messages. Signed-off-by: Kristian Slavov Acked-by: Jamal Hadi salim ACKed-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/rtnetlink.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index c231e9a08f0..d50482ba27f 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -866,6 +866,7 @@ enum rtnetlink_groups { #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_ROUTE, #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE + RTNLGRP_NOP1, RTNLGRP_IPV6_IFADDR, #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_MROUTE, @@ -876,8 +877,11 @@ enum rtnetlink_groups { #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO RTNLGRP_DECnet_IFADDR, #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR + RTNLGRP_NOP2, RTNLGRP_DECnet_ROUTE, #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE + RTNLGRP_NOP3, + RTNLGRP_NOP4, RTNLGRP_IPV6_PREFIX, #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX __RTNLGRP_MAX -- cgit v1.2.3 From b03664869aa6f84c3c98a06ac9d6905b195909bc Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Mon, 19 Dec 2005 14:00:08 -0800 Subject: [BRIDGE-NF]: Fix bridge-nf ipv6 length check A typo caused some bridged IPv6 packets to get dropped randomly, as reported by Sebastien Chaumontet. The patch below fixes this (using skb->nh.raw instead of raw) and also makes the jumbo packet length checking up-to-date with the code in net/ipv6/exthdrs.c::ipv6_hop_jumbo. Signed-off-by: Bart De Schuymer Signed-off-by: David S. Miller --- net/bridge/br_netfilter.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index d8e36b77512..43a0b35dfe6 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c @@ -295,7 +295,7 @@ static int check_hbh_len(struct sk_buff *skb) len -= 2; while (len > 0) { - int optlen = raw[off+1]+2; + int optlen = skb->nh.raw[off+1]+2; switch (skb->nh.raw[off]) { case IPV6_TLV_PAD0: @@ -308,18 +308,15 @@ static int check_hbh_len(struct sk_buff *skb) case IPV6_TLV_JUMBO: if (skb->nh.raw[off+1] != 4 || (off&3) != 2) goto bad; - pkt_len = ntohl(*(u32*)(skb->nh.raw+off+2)); - + if (pkt_len <= IPV6_MAXPLEN || + skb->nh.ipv6h->payload_len) + goto bad; if (pkt_len > skb->len - sizeof(struct ipv6hdr)) goto bad; - if (pkt_len + sizeof(struct ipv6hdr) < skb->len) { - if (__pskb_trim(skb, - pkt_len + sizeof(struct ipv6hdr))) - goto bad; - if (skb->ip_summed == CHECKSUM_HW) - skb->ip_summed = CHECKSUM_NONE; - } + if (pskb_trim_rcsum(skb, + pkt_len+sizeof(struct ipv6hdr))) + goto bad; break; default: if (optlen > len) -- cgit v1.2.3 From 3dd4bc68fac5df16b6d3ed6ed3c29cf05f29a47e Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 19 Dec 2005 14:02:45 -0800 Subject: [IPV6]: Fix route lifetime. The route expiration time is stored in rt6i_expires in jiffies. The argument of rt6_route_add() for adding a route is not the expiration time in jiffies nor in clock_t, but the lifetime (or time left before expiration) in clock_t. Because of the confusion, we sometimes saw several strange errors (FAILs) in TAHI IPv6 Ready Logo Phase-2 Self Test. The symptoms were analyzed by Mitsuru Chinen . Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 16 ++++++++++++---- net/ipv6/route.c | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 73a23b4130a..4ea8cf7c0cc 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1596,9 +1596,17 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) not good. */ if (valid_lft >= 0x7FFFFFFF/HZ) - rt_expires = 0; + rt_expires = 0x7FFFFFFF - (0x7FFFFFFF % HZ); else - rt_expires = jiffies + valid_lft * HZ; + rt_expires = valid_lft * HZ; + + /* + * We convert this (in jiffies) to clock_t later. + * Avoid arithmetic overflow there as well. + * Overflow can happen only if HZ < USER_HZ. + */ + if (HZ < USER_HZ && rt_expires > 0x7FFFFFFF / USER_HZ) + rt_expires = 0x7FFFFFFF / USER_HZ; if (pinfo->onlink) { struct rt6_info *rt; @@ -1610,12 +1618,12 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) ip6_del_rt(rt, NULL, NULL, NULL); rt = NULL; } else { - rt->rt6i_expires = rt_expires; + rt->rt6i_expires = jiffies + rt_expires; } } } else if (valid_lft) { addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len, - dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); + dev, jiffies_to_clock_t(rt_expires), RTF_ADDRCONF|RTF_EXPIRES|RTF_PREFIX_RT); } if (rt) dst_release(&rt->u.dst); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a7a537b5059..7c68bfbee36 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -829,7 +829,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, } rt->u.dst.obsolete = -1; - rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info); + rt->rt6i_expires = jiffies + clock_t_to_jiffies(rtmsg->rtmsg_info); if (nlh && (r = NLMSG_DATA(nlh))) { rt->rt6i_protocol = r->rtm_protocol; } else { -- cgit v1.2.3 From 9e999993c71e1506378d26d81f842277aff8a250 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 19 Dec 2005 14:03:46 -0800 Subject: [XFRM]: Handle DCCP in xfrm{4,6}_decode_session Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- net/ipv4/xfrm4_policy.c | 1 + net/ipv6/xfrm6_policy.c | 1 + 2 files changed, 2 insertions(+) diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index b2b60f3e9cd..42196ba3b0b 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -182,6 +182,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl) case IPPROTO_UDP: case IPPROTO_TCP: case IPPROTO_SCTP: + case IPPROTO_DCCP: if (pskb_may_pull(skb, xprth + 4 - skb->data)) { u16 *ports = (u16 *)xprth; diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index cf1d91e74c8..69bd957380e 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c @@ -214,6 +214,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl) case IPPROTO_UDP: case IPPROTO_TCP: case IPPROTO_SCTP: + case IPPROTO_DCCP: if (pskb_may_pull(skb, skb->nh.raw + offset + 4 - skb->data)) { u16 *ports = (u16 *)exthdr; -- cgit v1.2.3 From 7c612bfd4ed3064fd48a4877a114c8186547367b Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 19 Dec 2005 22:20:51 +0000 Subject: [ARM] 3210/1: add missing memory barrier helper for NPTL support Patch from Nicolas Pitre Strictly speaking, the NPTL kernel helpers are required for pre ARMv6 only. They are available on ARMv6+ as well for obvious compatibility reasons. However there are cases where extra memory barriers are needed when using an SMP ARMv6 machine but not on pre-ARMv6. This patch adds a memory barrier kernel helper that glibc can use as needed for pre-ARMv6 binaries to be forward compatible with an SMP kernel on ARMv6, as well as the necessary dmb instructions to the cmpxchg helper. Signed-off-by: Nicolas Pitre Acked-by: Daniel Jacobowitz Signed-off-by: Russell King --- arch/arm/kernel/entry-armv.S | 49 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index d9fb819bf7c..2a8d27e18fa 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -611,6 +611,47 @@ ENTRY(__switch_to) .globl __kuser_helper_start __kuser_helper_start: +/* + * Reference prototype: + * + * void __kernel_memory_barrier(void) + * + * Input: + * + * lr = return address + * + * Output: + * + * none + * + * Clobbered: + * + * the Z flag might be lost + * + * Definition and user space usage example: + * + * typedef void (__kernel_dmb_t)(void); + * #define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0) + * + * Apply any needed memory barrier to preserve consistency with data modified + * manually and __kuser_cmpxchg usage. + * + * This could be used as follows: + * + * #define __kernel_dmb() \ + * asm volatile ( "mov r0, #0xffff0fff; mov lr, pc; sub pc, r0, #95" \ + * : : : "lr","cc" ) + */ + +__kuser_memory_barrier: @ 0xffff0fa0 + +#if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_SMP) + mcr p15, 0, r0, c7, c10, 5 @ dmb +#endif + mov pc, lr + + .align 5 + /* * Reference prototype: * @@ -642,6 +683,8 @@ __kuser_helper_start: * The C flag is also set if *ptr was changed to allow for assembly * optimization in the calling code. * + * Note: this routine already includes memory barriers as needed. + * * For example, a user space atomic_add implementation could look like this: * * #define atomic_add(ptr, val) \ @@ -698,10 +741,16 @@ __kuser_cmpxchg: @ 0xffff0fc0 #else +#ifdef CONFIG_SMP + mcr p15, 0, r0, c7, c10, 5 @ dmb +#endif ldrex r3, [r2] subs r3, r3, r0 strexeq r3, r1, [r2] rsbs r0, r3, #0 +#ifdef CONFIG_SMP + mcr p15, 0, r0, c7, c10, 5 @ dmb +#endif mov pc, lr #endif -- cgit v1.2.3 From 399c180ac5f0cb66ef9479358e0b8b6bafcbeafe Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 19 Dec 2005 14:23:23 -0800 Subject: [IPSEC]: Perform SA switchover immediately. When we insert a new xfrm_state which potentially subsumes an existing one, make sure all cached bundles are flushed so that the new SA is used immediately. Signed-off-by: David S. Miller --- include/net/xfrm.h | 1 + net/xfrm/xfrm_policy.c | 19 ++++++++++++++----- net/xfrm/xfrm_state.c | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 5beae1ccd57..1cdb8791213 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -890,6 +890,7 @@ struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, extern void xfrm_policy_flush(void); extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); extern int xfrm_flush_bundles(void); +extern void xfrm_flush_all_bundles(void); extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family); extern void xfrm_init_pmtu(struct dst_entry *dst); diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 0db9e57013f..54a4be6a7d2 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1014,13 +1014,12 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) } EXPORT_SYMBOL(__xfrm_route_forward); -/* Optimize later using cookies and generation ids. */ - static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie) { - if (!stale_bundle(dst)) - return dst; - + /* If it is marked obsolete, which is how we even get here, + * then we have purged it from the policy bundle list and we + * did that for a good reason. + */ return NULL; } @@ -1104,6 +1103,16 @@ int xfrm_flush_bundles(void) return 0; } +static int always_true(struct dst_entry *dst) +{ + return 1; +} + +void xfrm_flush_all_bundles(void) +{ + xfrm_prune_bundles(always_true); +} + void xfrm_init_pmtu(struct dst_entry *dst) { do { diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 7cf48aa6c95..479effc9766 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -431,6 +431,8 @@ void xfrm_state_insert(struct xfrm_state *x) spin_lock_bh(&xfrm_state_lock); __xfrm_state_insert(x); spin_unlock_bh(&xfrm_state_lock); + + xfrm_flush_all_bundles(); } EXPORT_SYMBOL(xfrm_state_insert); @@ -478,6 +480,9 @@ out: spin_unlock_bh(&xfrm_state_lock); xfrm_state_put_afinfo(afinfo); + if (!err) + xfrm_flush_all_bundles(); + if (x1) { xfrm_state_delete(x1); xfrm_state_put(x1); -- cgit v1.2.3 From 9bffc4ace1ed875667dbe5b29065d96bec558c62 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Mon, 19 Dec 2005 14:24:40 -0800 Subject: [SCTP]: Fix sctp to not return erroneous POLLOUT events. Make sctp_writeable() use sk_wmem_alloc rather than sk_wmem_queued to determine the sndbuf space available. It also removes all the modifications to sk_wmem_queued as it is not currently used in SCTP. Signed-off-by: Neil Horman Signed-off-by: Sridhar Samudrala Signed-off-by: David S. Miller --- net/sctp/socket.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 1f7f244806b..9df888e932c 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -156,10 +156,6 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk) sizeof(struct sk_buff) + sizeof(struct sctp_chunk); - sk->sk_wmem_queued += SCTP_DATA_SNDSIZE(chunk) + - sizeof(struct sk_buff) + - sizeof(struct sctp_chunk); - atomic_add(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc); } @@ -4426,7 +4422,7 @@ cleanup: * tcp_poll(). Note that, based on these implementations, we don't * lock the socket in this function, even though it seems that, * ideally, locking or some other mechanisms can be used to ensure - * the integrity of the counters (sndbuf and wmem_queued) used + * the integrity of the counters (sndbuf and wmem_alloc) used * in this place. We assume that we don't need locks either until proven * otherwise. * @@ -4833,10 +4829,6 @@ static void sctp_wfree(struct sk_buff *skb) sizeof(struct sk_buff) + sizeof(struct sctp_chunk); - sk->sk_wmem_queued -= SCTP_DATA_SNDSIZE(chunk) + - sizeof(struct sk_buff) + - sizeof(struct sctp_chunk); - atomic_sub(sizeof(struct sctp_chunk), &sk->sk_wmem_alloc); sock_wfree(skb); @@ -4920,7 +4912,7 @@ void sctp_write_space(struct sock *sk) /* Is there any sndbuf space available on the socket? * - * Note that wmem_queued is the sum of the send buffers on all of the + * Note that sk_wmem_alloc is the sum of the send buffers on all of the * associations on the same socket. For a UDP-style socket with * multiple associations, it is possible for it to be "unwriteable" * prematurely. I assume that this is acceptable because @@ -4933,7 +4925,7 @@ static int sctp_writeable(struct sock *sk) { int amt = 0; - amt = sk->sk_sndbuf - sk->sk_wmem_queued; + amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amt < 0) amt = 0; return amt; -- cgit v1.2.3 From ce37e5f90366cb90320a285edd2113fd807f3ab6 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 19 Dec 2005 14:52:24 -0800 Subject: [SPARC]: Fix RTC build failure. On sparc and sparc64, the rtc driver doesn't compile with PCI support disabled. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- drivers/char/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index b46a72d782d..696f72787fe 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -687,7 +687,7 @@ config NVRAM config RTC tristate "Enhanced Real Time Clock Support" - depends on !PPC32 && !PARISC && !IA64 && !M68K + depends on !PPC32 && !PARISC && !IA64 && !M68K && (!(SPARC32 || SPARC64) || PCI) ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you -- cgit v1.2.3 From 8c2dc7e1e7213c55f1b97eba09de6c0cee9ad12f Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Mon, 19 Dec 2005 16:26:02 -0800 Subject: [TG3]: Fix peer device handling Locate the pdev_peer for dual port 5714 NIC devices in addition to 5704 devices. The name is also changed to tg3_find_peer() from tg3_find_5704_peer(). It is also necessary to call netdev_priv() to get to the peer's private tg3 structure. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index a23ed28a72b..d8691224b0b 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -1017,13 +1017,16 @@ static void tg3_frob_aux_power(struct tg3 *tp) if ((tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) != 0) return; - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { - tp_peer = pci_get_drvdata(tp->pdev_peer); - if (!tp_peer) + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) { + struct net_device *dev_peer; + + dev_peer = pci_get_drvdata(tp->pdev_peer); + if (!dev_peer) BUG(); + tp_peer = netdev_priv(dev_peer); } - if ((tp->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 || (tp_peer->tg3_flags & TG3_FLAG_WOL_ENABLE) != 0 || @@ -10466,7 +10469,7 @@ static char * __devinit tg3_bus_string(struct tg3 *tp, char *str) return str; } -static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) +static struct pci_dev * __devinit tg3_find_peer(struct tg3 *tp) { struct pci_dev *peer; unsigned int func, devnr = tp->pdev->devfn & ~7; @@ -10719,8 +10722,9 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, tp->rx_pending = 63; } - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) - tp->pdev_peer = tg3_find_5704_peer(tp); + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) || + (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714)) + tp->pdev_peer = tg3_find_peer(tp); err = tg3_get_device_address(tp); if (err) { -- cgit v1.2.3 From dc56b7d46dd2b303a844166ef931270b882bf08c Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Mon, 19 Dec 2005 16:26:28 -0800 Subject: [TG3]: Some low power fixes Add some missing workarounds in tg3_set_power_state(): 1. Workaround to prevent overdrawing current on 5714. 2. Do not power down 5700's PHY because of hw limitation. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index d8691224b0b..de898f175d7 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -1042,17 +1042,26 @@ static void tg3_frob_aux_power(struct tg3 *tp) udelay(100); } else { u32 no_gpio2; - u32 grc_local_ctrl; + u32 grc_local_ctrl = 0; if (tp_peer != tp && (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0) return; + /* Workaround to prevent overdrawing Amps. */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) == + ASIC_REV_5714) { + grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE3; + tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + grc_local_ctrl); + udelay(100); + } + /* On 5753 and variants, GPIO2 cannot be used. */ no_gpio2 = tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_NO_GPIO2; - grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 | + grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 | GRC_LCLCTRL_GPIO_OE1 | GRC_LCLCTRL_GPIO_OE2 | GRC_LCLCTRL_GPIO_OUTPUT1 | @@ -1297,7 +1306,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state) tg3_writephy(tp, MII_TG3_EXT_CTRL, MII_TG3_EXT_CTRL_FORCE_LED_OFF); tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x01b2); - tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700) + tg3_writephy(tp, MII_BMCR, BMCR_PDOWN); } } -- cgit v1.2.3 From b401e9e2ec44a5fc1d8053546276bff584b7118e Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Mon, 19 Dec 2005 16:27:04 -0800 Subject: [TG3]: Add tw32_wait_f() for some sensitive registers The tw32_f() function (register write with immediate read flush) can hang when used on some registers to switch clock frequencies and power. A new tw32_wait_f() is added for such registers with the delay before the read and after the read. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 151 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 74 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index de898f175d7..b0d963c8374 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -341,6 +341,16 @@ static struct { { "interrupt test (offline)" }, }; +static void tg3_write32(struct tg3 *tp, u32 off, u32 val) +{ + writel(val, tp->regs + off); +} + +static u32 tg3_read32(struct tg3 *tp, u32 off) +{ + return (readl(tp->regs + off)); +} + static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) { unsigned long flags; @@ -411,13 +421,29 @@ static u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off) return val; } -static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) +/* usec_wait specifies the wait time in usec when writing to certain registers + * where it is unsafe to read back the register without some delay. + * GRC_LOCAL_CTRL is one example if the GPIOs are toggled to switch power. + * TG3PCI_CLOCK_CTRL is another example if the clock frequencies are changed. + */ +static void _tw32_flush(struct tg3 *tp, u32 off, u32 val, u32 usec_wait) { - tp->write32(tp, off, val); - if (!(tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) && - !(tp->tg3_flags & TG3_FLAG_5701_REG_WRITE_BUG) && - !(tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)) - tp->read32(tp, off); /* flush */ + if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) || + (tp->tg3_flags2 & TG3_FLG2_ICH_WORKAROUND)) + /* Non-posted methods */ + tp->write32(tp, off, val); + else { + /* Posted method */ + tg3_write32(tp, off, val); + if (usec_wait) + udelay(usec_wait); + tp->read32(tp, off); + } + /* Wait again after the read for the posted method to guarantee that + * the wait time is met. + */ + if (usec_wait) + udelay(usec_wait); } static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val) @@ -438,16 +464,6 @@ static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val) readl(mbox); } -static void tg3_write32(struct tg3 *tp, u32 off, u32 val) -{ - writel(val, tp->regs + off); -} - -static u32 tg3_read32(struct tg3 *tp, u32 off) -{ - return (readl(tp->regs + off)); -} - #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) @@ -455,7 +471,8 @@ static u32 tg3_read32(struct tg3 *tp, u32 off) #define tr32_mailbox(reg) tp->read32_mbox(tp, reg) #define tw32(reg,val) tp->write32(tp, reg, val) -#define tw32_f(reg,val) _tw32_flush(tp,(reg),(val)) +#define tw32_f(reg,val) _tw32_flush(tp,(reg),(val), 0) +#define tw32_wait_f(reg,val,us) _tw32_flush(tp,(reg),(val), (us)) #define tr32(reg) tp->read32(tp, reg) static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) @@ -595,21 +612,19 @@ static void tg3_switch_clocks(struct tg3 *tp) if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { if (orig_clock_ctrl & CLOCK_CTRL_625_CORE) { - tw32_f(TG3PCI_CLOCK_CTRL, - clock_ctrl | CLOCK_CTRL_625_CORE); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, + clock_ctrl | CLOCK_CTRL_625_CORE, 40); } } else if ((orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) { - tw32_f(TG3PCI_CLOCK_CTRL, - clock_ctrl | - (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK)); - udelay(40); - tw32_f(TG3PCI_CLOCK_CTRL, - clock_ctrl | (CLOCK_CTRL_ALTCLK)); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, + clock_ctrl | + (CLOCK_CTRL_44MHZ_CORE | CLOCK_CTRL_ALTCLK), + 40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, + clock_ctrl | (CLOCK_CTRL_ALTCLK), + 40); } - tw32_f(TG3PCI_CLOCK_CTRL, clock_ctrl); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, clock_ctrl, 40); } #define PHY_BUSY_LOOPS 5000 @@ -1033,13 +1048,13 @@ static void tg3_frob_aux_power(struct tg3 *tp) (tp_peer->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0) { if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) { - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - (GRC_LCLCTRL_GPIO_OE0 | - GRC_LCLCTRL_GPIO_OE1 | - GRC_LCLCTRL_GPIO_OE2 | - GRC_LCLCTRL_GPIO_OUTPUT0 | - GRC_LCLCTRL_GPIO_OUTPUT1)); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + (GRC_LCLCTRL_GPIO_OE0 | + GRC_LCLCTRL_GPIO_OE1 | + GRC_LCLCTRL_GPIO_OE2 | + GRC_LCLCTRL_GPIO_OUTPUT0 | + GRC_LCLCTRL_GPIO_OUTPUT1), + 100); } else { u32 no_gpio2; u32 grc_local_ctrl = 0; @@ -1052,9 +1067,8 @@ static void tg3_frob_aux_power(struct tg3 *tp) if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) { grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE3; - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - grc_local_ctrl); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + grc_local_ctrl, 100); } /* On 5753 and variants, GPIO2 cannot be used. */ @@ -1070,21 +1084,18 @@ static void tg3_frob_aux_power(struct tg3 *tp) grc_local_ctrl &= ~(GRC_LCLCTRL_GPIO_OE2 | GRC_LCLCTRL_GPIO_OUTPUT2); } - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - grc_local_ctrl); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + grc_local_ctrl, 100); grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT0; - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - grc_local_ctrl); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + grc_local_ctrl, 100); if (!no_gpio2) { grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT2; - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - grc_local_ctrl); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + grc_local_ctrl, 100); } } } else { @@ -1094,19 +1105,16 @@ static void tg3_frob_aux_power(struct tg3 *tp) (tp_peer->tg3_flags & TG3_FLAG_INIT_COMPLETE) != 0) return; - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - (GRC_LCLCTRL_GPIO_OE1 | - GRC_LCLCTRL_GPIO_OUTPUT1)); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + (GRC_LCLCTRL_GPIO_OE1 | + GRC_LCLCTRL_GPIO_OUTPUT1), 100); - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - (GRC_LCLCTRL_GPIO_OE1)); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + GRC_LCLCTRL_GPIO_OE1, 100); - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | - (GRC_LCLCTRL_GPIO_OE1 | - GRC_LCLCTRL_GPIO_OUTPUT1)); - udelay(100); + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl | + (GRC_LCLCTRL_GPIO_OE1 | + GRC_LCLCTRL_GPIO_OUTPUT1), 100); } } } @@ -1149,10 +1157,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state) udelay(100); /* Delay after power state change */ /* Switch out of Vaux if it is not a LOM */ - if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT)) { - tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl); - udelay(100); - } + if (!(tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT)) + tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100); return 0; @@ -1251,10 +1257,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state) base_val |= (CLOCK_CTRL_RXCLK_DISABLE | CLOCK_CTRL_TXCLK_DISABLE); - tw32_f(TG3PCI_CLOCK_CTRL, base_val | - CLOCK_CTRL_ALTCLK | - CLOCK_CTRL_PWRDOWN_PLL133); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK | + CLOCK_CTRL_PWRDOWN_PLL133, 40); } else if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) { /* do nothing */ } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && @@ -1275,11 +1279,11 @@ static int tg3_set_power_state(struct tg3 *tp, int state) newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE; } - tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits1); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits1, + 40); - tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2, + 40); if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { u32 newbits3; @@ -1293,9 +1297,8 @@ static int tg3_set_power_state(struct tg3 *tp, int state) newbits3 = CLOCK_CTRL_44MHZ_CORE; } - tw32_f(TG3PCI_CLOCK_CTRL, - tp->pci_clock_ctrl | newbits3); - udelay(40); + tw32_wait_f(TG3PCI_CLOCK_CTRL, + tp->pci_clock_ctrl | newbits3, 40); } } -- cgit v1.2.3 From 38690194bc897dd60a61a71b15e861e13b5d8bdd Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Mon, 19 Dec 2005 16:27:28 -0800 Subject: [TG3]: Fix ethtool memory test Skip the memory 0xb50 to 0x1000 during "ethtool -t" memory test. Overwriting memory in this region can cause ASF problems. Update version and release date. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index b0d963c8374..cefb0c08a68 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -68,8 +68,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.45" -#define DRV_MODULE_RELDATE "Dec 13, 2005" +#define DRV_MODULE_VERSION "3.46" +#define DRV_MODULE_RELDATE "Dec 19, 2005" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -7975,13 +7975,12 @@ static int tg3_test_memory(struct tg3 *tp) u32 offset; u32 len; } mem_tbl_570x[] = { - { 0x00000000, 0x01000}, + { 0x00000000, 0x00b50}, { 0x00002000, 0x1c000}, { 0xffffffff, 0x00000} }, mem_tbl_5705[] = { { 0x00000100, 0x0000c}, { 0x00000200, 0x00008}, - { 0x00000b50, 0x00400}, { 0x00004000, 0x00800}, { 0x00006000, 0x01000}, { 0x00008000, 0x02000}, -- cgit v1.2.3 From f98d2dfd02183e016a6295f72140c60d691c9188 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Mon, 19 Dec 2005 11:49:24 -0800 Subject: [PATCH] block: Cleanup CDROMEJECT ioctl This is just a basic cleanup. No change in functionality. Signed-off-by: Ben Collins Signed-off-by: Linus Torvalds --- block/scsi_ioctl.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 382dea7b224..6e7db2e79f4 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -442,11 +442,37 @@ error: return err; } + +/* Send basic block requests */ +static int __blk_send_generic(request_queue_t *q, struct gendisk *bd_disk, int cmd, int data) +{ + struct request *rq; + int err; + + rq = blk_get_request(q, WRITE, __GFP_WAIT); + rq->flags |= REQ_BLOCK_PC; + rq->data = NULL; + rq->data_len = 0; + rq->timeout = BLK_DEFAULT_TIMEOUT; + memset(rq->cmd, 0, sizeof(rq->cmd)); + rq->cmd[0] = cmd; + rq->cmd[4] = data; + rq->cmd_len = 6; + err = blk_execute_rq(q, bd_disk, rq, 0); + blk_put_request(rq); + + return err; +} + +static inline int blk_send_start_stop(request_queue_t *q, struct gendisk *bd_disk, int data) +{ + return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data); +} + int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg) { request_queue_t *q; - struct request *rq; - int close = 0, err; + int err; q = bd_disk->queue; if (!q) @@ -564,19 +590,10 @@ int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, err = sg_scsi_ioctl(file, q, bd_disk, arg); break; case CDROMCLOSETRAY: - close = 1; + err = blk_send_start_stop(q, bd_disk, 0x03); + break; case CDROMEJECT: - rq = blk_get_request(q, WRITE, __GFP_WAIT); - rq->flags |= REQ_BLOCK_PC; - rq->data = NULL; - rq->data_len = 0; - rq->timeout = BLK_DEFAULT_TIMEOUT; - memset(rq->cmd, 0, sizeof(rq->cmd)); - rq->cmd[0] = GPCMD_START_STOP_UNIT; - rq->cmd[4] = 0x02 + (close != 0); - rq->cmd_len = 6; - err = blk_execute_rq(q, bd_disk, rq, 0); - blk_put_request(rq); + err = blk_send_start_stop(q, bd_disk, 0x02); break; default: err = -ENOTTY; -- cgit v1.2.3 From bcb97940f31ded5ac551da8bfc849583203fc6f2 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 20 Dec 2005 11:07:00 +1100 Subject: [PATCH] md: Change case of raid level reported in sys/mdX/md/level I had thought that keeping the reported tail level clearly different from the module name was a good idea, but I've changed my mind. 'raid5' is better and probably less confusing than 'RAID-5'. Signed-off-by: Neil Brown Signed-off-by: Linus Torvalds --- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index cd12fca73b0..8175a2a222d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1729,7 +1729,7 @@ level_show(mddev_t *mddev, char *page) if (p == NULL && mddev->raid_disks == 0) return 0; if (mddev->level >= 0) - return sprintf(page, "RAID-%d\n", mddev->level); + return sprintf(page, "raid%d\n", mddev->level); else return sprintf(page, "%s\n", p->name); } -- cgit v1.2.3 From b079fa7baa86b47579f3f60f86d03d21c76159b8 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 13 Dec 2005 16:13:52 -0500 Subject: RPC: Do not block on skb allocation If we get something like the following, [ 125.300636] [] schedule_timeout+0x54/0xa5 [ 125.305931] [] io_schedule_timeout+0x29/0x33 [ 125.311495] [] blk_congestion_wait+0x70/0x85 [ 125.317058] [] throttle_vm_writeout+0x69/0x7d [ 125.322720] [] shrink_zone+0xe0/0xfa [ 125.327560] [] shrink_caches+0x6d/0x6f [ 125.332581] [] try_to_free_pages+0xd0/0x1b5 [ 125.338056] [] __alloc_pages+0x135/0x2e8 [ 125.343258] [] tcp_sendmsg+0xaa0/0xb78 [ 125.348281] [] inet_sendmsg+0x48/0x53 [ 125.353212] [] sock_sendmsg+0xb8/0xd3 [ 125.358147] [] kernel_sendmsg+0x42/0x4f [ 125.363259] [] sock_no_sendpage+0x5e/0x77 [ 125.368556] [] xs_tcp_send_request+0x2af/0x375 then the socket is blocked until memory is reclaimed, and no progress can ever be made. Try to access the emergency pools by using GFP_ATOMIC. Signed-off-by: Trond Myklebust --- net/sunrpc/xprtsock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 0a51fd46a84..77e8800d412 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -990,6 +990,7 @@ static void xs_udp_connect_worker(void *args) sk->sk_data_ready = xs_udp_data_ready; sk->sk_write_space = xs_udp_write_space; sk->sk_no_check = UDP_CSUM_NORCV; + sk->sk_allocation = GFP_ATOMIC; xprt_set_connected(xprt); @@ -1074,6 +1075,7 @@ static void xs_tcp_connect_worker(void *args) sk->sk_data_ready = xs_tcp_data_ready; sk->sk_state_change = xs_tcp_state_change; sk->sk_write_space = xs_tcp_write_space; + sk->sk_allocation = GFP_ATOMIC; /* socket options */ sk->sk_userlocks |= SOCK_BINDPORT_LOCK; -- cgit v1.2.3 From 29884df0d89c1df0dec3449405bc41569bb44800 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 13 Dec 2005 16:13:54 -0500 Subject: NFS: Fix another O_DIRECT race Ensure we call unmap_mapping_range() and sync dirty pages to disk before doing an NFS direct write. Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 24 ++++++------------------ fs/nfs/file.c | 23 ++++------------------- fs/nfs/inode.c | 28 +++++++++++++++++++++++----- include/linux/nfs_fs.h | 1 + 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index b497c71384e..07922881760 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -678,15 +678,9 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t if (!count) goto out; - if (mapping->nrpages) { - retval = filemap_fdatawrite(mapping); - if (retval == 0) - retval = nfs_wb_all(inode); - if (retval == 0) - retval = filemap_fdatawait(mapping); - if (retval) - goto out; - } + retval = nfs_sync_mapping(mapping); + if (retval) + goto out; retval = nfs_direct_read(inode, ctx, &iov, pos, 1); if (retval > 0) @@ -764,15 +758,9 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, if (!count) goto out; - if (mapping->nrpages) { - retval = filemap_fdatawrite(mapping); - if (retval == 0) - retval = nfs_wb_all(inode); - if (retval == 0) - retval = filemap_fdatawait(mapping); - if (retval) - goto out; - } + retval = nfs_sync_mapping(mapping); + if (retval) + goto out; retval = nfs_direct_write(inode, ctx, &iov, pos, 1); if (mapping->nrpages) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 57d3e77d97e..eb5cd4c3bbf 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -433,11 +433,7 @@ static int do_unlk(struct file *filp, int cmd, struct file_lock *fl) * Flush all pending writes before doing anything * with locks.. */ - filemap_fdatawrite(filp->f_mapping); - down(&inode->i_sem); - nfs_wb_all(inode); - up(&inode->i_sem); - filemap_fdatawait(filp->f_mapping); + nfs_sync_mapping(filp->f_mapping); /* NOTE: special case * If we're signalled while cleaning up locks on process exit, we @@ -465,15 +461,8 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) * Flush all pending writes before doing anything * with locks.. */ - status = filemap_fdatawrite(filp->f_mapping); - if (status == 0) { - down(&inode->i_sem); - status = nfs_wb_all(inode); - up(&inode->i_sem); - if (status == 0) - status = filemap_fdatawait(filp->f_mapping); - } - if (status < 0) + status = nfs_sync_mapping(filp->f_mapping); + if (status != 0) goto out; lock_kernel(); @@ -497,11 +486,7 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) * Make sure we clear the cache whenever we try to get the lock. * This makes locking act as a cache coherency point. */ - filemap_fdatawrite(filp->f_mapping); - down(&inode->i_sem); - nfs_wb_all(inode); /* we may have slept */ - up(&inode->i_sem); - filemap_fdatawait(filp->f_mapping); + nfs_sync_mapping(filp->f_mapping); nfs_zap_caches(inode); out: rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset); diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index afd75d0463f..432f41cd75e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -640,6 +640,27 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) return 0; } +/** + * nfs_sync_mapping - helper to flush all mmapped dirty data to disk + */ +int nfs_sync_mapping(struct address_space *mapping) +{ + int ret; + + if (mapping->nrpages == 0) + return 0; + unmap_mapping_range(mapping, 0, 0, 0); + ret = filemap_fdatawrite(mapping); + if (ret != 0) + goto out; + ret = filemap_fdatawait(mapping); + if (ret != 0) + goto out; + ret = nfs_wb_all(mapping->host); +out: + return ret; +} + /* * Invalidate the local caches */ @@ -1179,11 +1200,8 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) struct nfs_inode *nfsi = NFS_I(inode); if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { - if (S_ISREG(inode->i_mode)) { - if (filemap_fdatawrite(mapping) == 0) - filemap_fdatawait(mapping); - nfs_wb_all(inode); - } + if (S_ISREG(inode->i_mode)) + nfs_sync_mapping(mapping); invalidate_inode_pages2(mapping); spin_lock(&inode->i_lock); diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 12787a9b025..2516adeccec 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -291,6 +291,7 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long /* * linux/fs/nfs/inode.c */ +extern int nfs_sync_mapping(struct address_space *mapping); extern void nfs_zap_caches(struct inode *); extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, struct nfs_fattr *); -- cgit v1.2.3 From 48e49187753ec3b4fa84a7165c9b7a59f3875b56 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 19 Dec 2005 17:11:22 -0500 Subject: SUNRPC: Fix "EPIPE" error on mount of rpcsec_gss-protected partitions gss_create_upcall() should not error just because rpc.gssd closed the pipe on its end. Instead, it should requeue the pending requests and then retry. Signed-off-by: Trond Myklebust --- net/sunrpc/auth_gss/auth_gss.c | 6 ++++-- net/sunrpc/rpc_pipe.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index f44f46f1d8e..8d782282ec1 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -638,7 +638,7 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg *msg) gss_msg); atomic_inc(&gss_msg->count); gss_unhash_msg(gss_msg); - if (msg->errno == -ETIMEDOUT || msg->errno == -EPIPE) { + if (msg->errno == -ETIMEDOUT) { unsigned long now = jiffies; if (time_after(now, ratelimit)) { printk(KERN_WARNING "RPC: AUTH_GSS upcall timed out.\n" @@ -786,7 +786,9 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int taskflags) cred->gc_flags = 0; cred->gc_base.cr_ops = &gss_credops; cred->gc_service = gss_auth->service; - err = gss_create_upcall(gss_auth, cred); + do { + err = gss_create_upcall(gss_auth, cred); + } while (err == -EAGAIN); if (err < 0) goto out_err; diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index c76ea221798..16a2458f38f 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -174,7 +174,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp) goto out; msg = (struct rpc_pipe_msg *)filp->private_data; if (msg != NULL) { - msg->errno = -EPIPE; + msg->errno = -EAGAIN; list_del_init(&msg->list); rpci->ops->destroy_msg(msg); } @@ -183,7 +183,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp) if (filp->f_mode & FMODE_READ) rpci->nreaders --; if (!rpci->nreaders) - __rpc_purge_upcall(inode, -EPIPE); + __rpc_purge_upcall(inode, -EAGAIN); if (rpci->ops->release_pipe) rpci->ops->release_pipe(inode); out: -- cgit v1.2.3 From 9b5b1f5bf9dcdb6f23abf65977a675eb4deba3c0 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 19 Dec 2005 17:11:25 -0500 Subject: NLM: Fix Oops in nlmclnt_mark_reclaim() When mixing -olock and -onolock mounts on the same client, we have to check that fl->fl_u.nfs_fl.owner is set before dereferencing it. Signed-off-by: Trond Myklebust --- fs/lockd/clntlock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 006bb9e1457..3eaf6e70108 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -157,6 +157,8 @@ void nlmclnt_mark_reclaim(struct nlm_host *host) inode = fl->fl_file->f_dentry->d_inode; if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) continue; + if (fl->fl_u.nfs_fl.owner == NULL) + continue; if (fl->fl_u.nfs_fl.owner->host != host) continue; if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED)) @@ -226,6 +228,8 @@ restart: inode = fl->fl_file->f_dentry->d_inode; if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) continue; + if (fl->fl_u.nfs_fl.owner == NULL) + continue; if (fl->fl_u.nfs_fl.owner->host != host) continue; if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_RECLAIM)) -- cgit v1.2.3 From 3eb6f26bcd0d2ce53498deda988e68d663e1c9c2 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 20 Dec 2005 15:38:47 +1100 Subject: powerpc: correct register usage in 64-bit syscall exit path Since we don't restore the volatile registers in the syscall exit path, we need to make sure we don't leak any potentially interesting values from the kernel to userspace. This was already the case for all except r11. This makes it use r11 for an MSR value, so r11 will have an (uninteresting) MSR value in it on return to userspace. Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/entry_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 2d22bf03484..bce33a38399 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -183,8 +183,8 @@ syscall_exit_trace_cont: ld r13,GPR13(r1) /* returning to usermode */ 1: ld r2,GPR2(r1) li r12,MSR_RI - andc r10,r10,r12 - mtmsrd r10,1 /* clear MSR.RI */ + andc r11,r10,r12 + mtmsrd r11,1 /* clear MSR.RI */ ld r1,GPR1(r1) mtlr r4 mtcr r5 -- cgit v1.2.3 From b273ed266a353ee6b238856e1ae705660dafdd70 Mon Sep 17 00:00:00 2001 From: Edson Seabra Date: Mon, 19 Dec 2005 09:16:50 -0600 Subject: [PATCH] powerpc: CPM2 interrupt handler failure after 100,000 interrupts The CPM2 interrupt handler does not return success to the IRQ subsystem, which causes it to kill the IRQ line after 100,000 interrupts. Signed-off-by: Edson Seabra Signed-off-by: Marcelo Tosatti Signed-off-by: Kumar Gala Signed-off-by: Paul Mackerras --- arch/ppc/platforms/85xx/mpc85xx_cds_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c index d8991b88dc9..5e8cc5ec6ab 100644 --- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c +++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c @@ -130,10 +130,11 @@ mpc85xx_cds_show_cpuinfo(struct seq_file *m) } #ifdef CONFIG_CPM2 -static void cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs) { while((irq = cpm2_get_irq(regs)) >= 0) __do_IRQ(irq, regs); + return IRQ_HANDLED; } static struct irqaction cpm2_irqaction = { -- cgit v1.2.3 From 5a1244e9ddb77eafb1de69a1be14e06ca04e733a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 20 Dec 2005 16:00:17 +1100 Subject: powerpc: update defconfigs Signed-off-by: Paul Mackerras --- arch/powerpc/configs/cell_defconfig | 7 ++++--- arch/powerpc/configs/g5_defconfig | 9 +++++---- arch/powerpc/configs/iseries_defconfig | 7 ++++--- arch/powerpc/configs/maple_defconfig | 10 +++++----- arch/powerpc/configs/ppc64_defconfig | 7 ++++--- arch/powerpc/configs/pseries_defconfig | 7 ++++--- 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig index 4b433411b9e..b657f7e4476 100644 --- a/arch/powerpc/configs/cell_defconfig +++ b/arch/powerpc/configs/cell_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Tue Nov 15 14:36:20 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:26 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -53,6 +53,7 @@ CONFIG_KOBJECT_UEVENT=y # CONFIG_IKCONFIG is not set # CONFIG_CPUSETS is not set CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set @@ -151,7 +152,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_PPC_64K_PAGES is not set CONFIG_SCHED_SMT=y CONFIG_PROC_DEVICETREE=y diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index e7c23e3902b..3c22ccb1851 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Tue Nov 15 14:39:20 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:30 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -53,6 +53,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set @@ -162,7 +163,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_PPC_64K_PAGES is not set # CONFIG_SCHED_SMT is not set CONFIG_PROC_DEVICETREE=y @@ -1203,6 +1204,7 @@ CONFIG_USB_MON=y CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_GENERIC=y # CONFIG_USB_SERIAL_AIRPRIME is not set +# CONFIG_USB_SERIAL_ANYDATA is not set CONFIG_USB_SERIAL_BELKIN=m CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m # CONFIG_USB_SERIAL_CP2101 is not set @@ -1233,7 +1235,6 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y CONFIG_USB_SERIAL_KLSI=m CONFIG_USB_SERIAL_KOBIL_SCT=m CONFIG_USB_SERIAL_MCT_U232=m -# CONFIG_USB_SERIAL_NOKIA_DKU2 is not set CONFIG_USB_SERIAL_PL2303=m # CONFIG_USB_SERIAL_HP4X is not set CONFIG_USB_SERIAL_SAFE=m diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig index 5d0866707a7..751a622fb7a 100644 --- a/arch/powerpc/configs/iseries_defconfig +++ b/arch/powerpc/configs/iseries_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Tue Nov 15 14:38:09 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:32 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -55,6 +55,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set @@ -144,7 +145,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_PPC_64K_PAGES is not set # CONFIG_SCHED_SMT is not set CONFIG_PROC_DEVICETREE=y diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 92e42613ef0..07b6d3d2336 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Tue Nov 15 14:38:58 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:36 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -53,6 +53,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y @@ -149,7 +150,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_PPC_64K_PAGES is not set # CONFIG_SCHED_SMT is not set CONFIG_PROC_DEVICETREE=y @@ -242,7 +243,6 @@ CONFIG_TCP_CONG_BIC=y # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set # # Network testing @@ -794,6 +794,7 @@ CONFIG_USB_SERIAL=y # CONFIG_USB_SERIAL_CONSOLE is not set CONFIG_USB_SERIAL_GENERIC=y # CONFIG_USB_SERIAL_AIRPRIME is not set +# CONFIG_USB_SERIAL_ANYDATA is not set # CONFIG_USB_SERIAL_BELKIN is not set # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set # CONFIG_USB_SERIAL_CP2101 is not set @@ -824,7 +825,6 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y # CONFIG_USB_SERIAL_KLSI is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set # CONFIG_USB_SERIAL_MCT_U232 is not set -# CONFIG_USB_SERIAL_NOKIA_DKU2 is not set # CONFIG_USB_SERIAL_PL2303 is not set # CONFIG_USB_SERIAL_HP4X is not set # CONFIG_USB_SERIAL_SAFE is not set diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index b5ba3bbd96f..509399eab6f 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Fri Nov 18 16:23:24 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:38 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -54,6 +54,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_CPUSETS=y CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y @@ -176,7 +177,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y # CONFIG_SPARSEMEM_STATIC is not set CONFIG_SPARSEMEM_EXTREME=y # CONFIG_MEMORY_HOTPLUG is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 # CONFIG_PPC_64K_PAGES is not set # CONFIG_SCHED_SMT is not set CONFIG_PROC_DEVICETREE=y diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index b589b196eb3..a50ce0fa924 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.15-rc1 -# Tue Nov 15 14:36:55 2005 +# Linux kernel version: 2.6.15-rc5 +# Tue Dec 20 15:59:40 2005 # CONFIG_PPC64=y CONFIG_64BIT=y @@ -55,6 +55,7 @@ CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_CPUSETS=y CONFIG_INITRAMFS_SOURCE="" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y @@ -163,7 +164,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y # CONFIG_SPARSEMEM_STATIC is not set CONFIG_SPARSEMEM_EXTREME=y # CONFIG_MEMORY_HOTPLUG is not set -CONFIG_SPLIT_PTLOCK_CPUS=4096 +CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y # CONFIG_PPC_64K_PAGES is not set CONFIG_SCHED_SMT=y -- cgit v1.2.3 From 6ee7fb7e363aa8828b3920422416707c79f39007 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Mon, 19 Dec 2005 11:24:53 +1100 Subject: [PATCH] powerpc: g5 thermal overtemp bug The g5 thermal control for liquid cooled machines has a small bug, when the temperatures gets too high, it boosts all fans to the max, but incorrectly sets the liquids pump to the min instead of the max speed, thus causing the overtemp condition not to clear and the machine to shut down after a while. This fixes it to set the pumps to max speed instead. This problem might explain some of the reports of random shutdowns that some g5 users have been reporting in the past. Many thanks to Marcus Rothe for spending a lot of time trying various patches & sending log logs before I found out that typo. Note that overtemp handling is still not perfect and the machine might still shutdown, that patch should reduce if not eliminate such occcurences in "normal" conditions with high load. I'll implement a better handling with proper slowing down of the CPUs later. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Linus Torvalds --- drivers/macintosh/therm_pm72.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 3fc8cdd94c3..5bb36274a5c 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -933,7 +933,7 @@ static void do_monitor_cpu_combined(void) if (state0->overtemp > 0) { state0->rpm = state0->mpu.rmaxn_exhaust_fan; state0->intake_rpm = intake = state0->mpu.rmaxn_intake_fan; - pump = state0->pump_min; + pump = state0->pump_max; goto do_set_fans; } -- cgit v1.2.3 From 4b3760ce3d448d4af3036cd6c650d651a16ee02d Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Mon, 19 Dec 2005 15:11:40 +0800 Subject: [PATCH] intelfb: Fix freeing of nonexistent resource Fix intelfb trying to free a non-existent resource in its error path. Signed-off-by: Antonino Daplas Signed-off-by: Linus Torvalds --- drivers/video/intelfb/intelfb.h | 5 +++++ drivers/video/intelfb/intelfbdrv.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h index f077ca34fab..da29d007f21 100644 --- a/drivers/video/intelfb/intelfb.h +++ b/drivers/video/intelfb/intelfb.h @@ -41,6 +41,10 @@ /*** hw-related values ***/ +/* Resource Allocation */ +#define INTELFB_FB_ACQUIRED 1 +#define INTELFB_MMIO_ACQUIRED 2 + /* PCI ids for supported devices */ #define PCI_DEVICE_ID_INTEL_830M 0x3577 #define PCI_DEVICE_ID_INTEL_845G 0x2562 @@ -257,6 +261,7 @@ struct intelfb_info { int hwcursor; int fixed_mode; int ring_active; + int flag; /* hw cursor */ int cursor_on; diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 427689e584d..ac8d6617095 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -473,9 +473,9 @@ cleanup(struct intelfb_info *dinfo) if (dinfo->aperture.virtual) iounmap((void __iomem *)dinfo->aperture.virtual); - if (dinfo->mmio_base_phys) + if (dinfo->flag & INTELFB_MMIO_ACQUIRED) release_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE); - if (dinfo->aperture.physical) + if (dinfo->flag & INTELFB_FB_ACQUIRED) release_mem_region(dinfo->aperture.physical, dinfo->aperture.size); framebuffer_release(dinfo->info); @@ -572,6 +572,9 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) cleanup(dinfo); return -ENODEV; } + + dinfo->flag |= INTELFB_FB_ACQUIRED; + if (!request_mem_region(dinfo->mmio_base_phys, INTEL_REG_SIZE, INTELFB_MODULE_NAME)) { @@ -580,6 +583,8 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) return -ENODEV; } + dinfo->flag |= INTELFB_MMIO_ACQUIRED; + /* Get the chipset info. */ dinfo->pci_chipset = pdev->device; -- cgit v1.2.3 From 33c37c06f8066342764bd1568c9f3524efe889a5 Mon Sep 17 00:00:00 2001 From: "Antonino A. Daplas" Date: Mon, 19 Dec 2005 15:11:49 +0800 Subject: [PATCH] intelfb: Fix oops when changing video mode Reported by: janis huang (Bugzilla Bug 5747) Fix on oops in intelfb. Not sure what's happening, looks like dinfo->name pointer is invalidated after initialization. Remove intelfb_get_fix, it's not needed and move the majority of the code to the initialization routine. Signed-off-by: Antonino Daplas Signed-off-by: Linus Torvalds --- drivers/video/intelfb/intelfbdrv.c | 42 ++++++++++++-------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index ac8d6617095..0090544842f 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -135,9 +135,6 @@ static void __devinit get_initial_mode(struct intelfb_info *dinfo); static void update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var); -static int intelfb_get_fix(struct fb_fix_screeninfo *fix, - struct fb_info *info); - static int intelfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info); static int intelfb_set_par(struct fb_info *info); @@ -1096,7 +1093,17 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo) return 1; info->pixmap.scan_align = 1; - + strcpy(info->fix.id, dinfo->name); + info->fix.smem_start = dinfo->fb.physical; + info->fix.smem_len = dinfo->fb.size; + info->fix.type = FB_TYPE_PACKED_PIXELS; + info->fix.type_aux = 0; + info->fix.xpanstep = 8; + info->fix.ypanstep = 1; + info->fix.ywrapstep = 0; + info->fix.mmio_start = dinfo->mmio_base_phys; + info->fix.mmio_len = INTEL_REG_SIZE; + info->fix.accel = FB_ACCEL_I830; update_dinfo(dinfo, &info->var); return 0; @@ -1114,7 +1121,8 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) dinfo->yres = var->xres; dinfo->pixclock = var->pixclock; - intelfb_get_fix(&dinfo->info->fix, dinfo->info); + dinfo->info->fix.visual = dinfo->visual; + dinfo->info->fix.line_length = dinfo->pitch; switch (dinfo->bpp) { case 8: @@ -1144,30 +1152,6 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var) /* fbops functions */ -static int -intelfb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) -{ - struct intelfb_info *dinfo = GET_DINFO(info); - - DBG_MSG("intelfb_get_fix\n"); - - memset(fix, 0, sizeof(*fix)); - strcpy(fix->id, dinfo->name); - fix->smem_start = dinfo->fb.physical; - fix->smem_len = dinfo->fb.size; - fix->type = FB_TYPE_PACKED_PIXELS; - fix->type_aux = 0; - fix->visual = dinfo->visual; - fix->xpanstep = 8; - fix->ypanstep = 1; - fix->ywrapstep = 0; - fix->line_length = dinfo->pitch; - fix->mmio_start = dinfo->mmio_base_phys; - fix->mmio_len = INTEL_REG_SIZE; - fix->accel = FB_ACCEL_I830; - return 0; -} - /*************************************************************** * fbdev interface * ***************************************************************/ -- cgit v1.2.3 From 7ca0b3bf695632003a2a0f98b9fc1451b0483346 Mon Sep 17 00:00:00 2001 From: Knut Petersen Date: Tue, 20 Dec 2005 08:18:09 +0100 Subject: [PATCH] Fix framebuffer console upside-down ywrap scrolling Whenever ywrap scrolling is selected together with 180 degree screen rotation, 2.6.15-rc6 and earlier versions are broken. fb_pan_display() expects non-negative yoffsets, but ud_update_start() calls it with yoffsets down to -(yres - font height). This patch transforms yoffset to the correct range 0 ... vyres-1. Some obviously unneeded parentheses are removed, too. Verified with cyblafb, should be applied before 2.6.15-final because it does fix the framebuffer rotation code introduced early in the 2.6.15 release cycle. Signed-off-by: Knut Petersen Acked-by: Antonino Daplas Signed-off-by: Linus Torvalds --- drivers/video/console/fbcon_ud.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c index c4d7c89212b..9dd059e8b64 100644 --- a/drivers/video/console/fbcon_ud.c +++ b/drivers/video/console/fbcon_ud.c @@ -420,13 +420,15 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int ud_update_start(struct fb_info *info) { struct fbcon_ops *ops = info->fbcon_par; - u32 xoffset, yoffset; + int xoffset, yoffset; u32 vyres = GETVYRES(ops->p->scrollmode, info); u32 vxres = GETVXRES(ops->p->scrollmode, info); int err; - xoffset = (vxres - info->var.xres) - ops->var.xoffset; - yoffset = (vyres - info->var.yres) - ops->var.yoffset; + xoffset = vxres - info->var.xres - ops->var.xoffset; + yoffset = vyres - info->var.yres - ops->var.yoffset; + if (yoffset < 0) + yoffset += vyres; ops->var.xoffset = xoffset; ops->var.yoffset = yoffset; err = fb_pan_display(info, &ops->var); -- cgit v1.2.3 From 7e8702334841b6da4b8f564dc1771ca17c59a621 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 20 Dec 2005 14:45:19 +0100 Subject: [PATCH] Fix swiotlb pci_map_sg error handling The overflow checking condition in lib/swiotlb.c was wrong. It would first run a NULL pointer through virt_to_phys before testing it. Since pci_map_sg overflow is not that uncommon and causes data corruption (including broken file systems) when not properly detected I think it's better to fix it in 2.6.15. This affects x86-64 and IA64. Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds --- lib/swiotlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 57216f3544c..1ff8dcebf7c 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -704,8 +704,9 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems, addr = SG_ENT_VIRT_ADDRESS(sg); dev_addr = virt_to_phys(addr); if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) { - sg->dma_address = (dma_addr_t) virt_to_phys(map_single(hwdev, addr, sg->length, dir)); - if (!sg->dma_address) { + void *map = map_single(hwdev, addr, sg->length, dir); + sg->dma_address = virt_to_bus(map); + if (!map) { /* Don't panic here, we expect map_sg users to do proper error handling. */ swiotlb_full(hwdev, sg->length, dir, 0); -- cgit v1.2.3 From 9e28393998d3d0733097306762f6d1c083fc92c6 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Tue, 20 Dec 2005 15:21:24 +0100 Subject: [PATCH] kernel/params.c: fix sysfs access with CONFIG_MODULES=n All the work was done to setup the file and maintain the file handles but the access functions were zeroed out due to the #ifdef. Removing the #ifdef allows full access to all the parameters when CONFIG_MODULES=n. akpm: put it back again, but use CONFIG_SYSFS instead. Signed-off-by: Jason Wessel Signed-off-by: Andrew Morton Signed-off-by: Adrian Bunk Signed-off-by: Linus Torvalds --- kernel/params.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/params.c b/kernel/params.c index 47ba6954794..c76ad25e6a2 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -619,7 +619,7 @@ static void __init param_sysfs_builtin(void) /* module-related sysfs stuff */ -#ifdef CONFIG_MODULES +#ifdef CONFIG_SYSFS #define to_module_attr(n) container_of(n, struct module_attribute, attr); #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); -- cgit v1.2.3 From b7964c3d88668cef57e1a99861477168eeff4743 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Tue, 20 Dec 2005 16:29:05 +0100 Subject: [PATCH] nfsd: check for read-only exports before setting acls We must check for MAY_SATTR before setting acls, which includes checking for read-only exports: the lower-level setxattr operation that eventually sets the acl cannot check export-level restrictions. Bug reported by Martin Walter . Signed-off-by: Andreas Gruenbacher Acked-by: Trond Myklebust Signed-off-by: Linus Torvalds --- fs/nfsd/nfs2acl.c | 2 +- fs/nfsd/nfs3acl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 7cbf0682b2f..fc95c4df669 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c @@ -107,7 +107,7 @@ static int nfsacld_proc_setacl(struct svc_rqst * rqstp, dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); fh = fh_copy(&resp->fh, &argp->fh); - nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); + nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); if (!nfserr) { nfserr = nfserrno( nfsd_set_posix_acl( diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 64ba40572fe..16e10c170ae 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c @@ -101,7 +101,7 @@ static int nfsd3_proc_setacl(struct svc_rqst * rqstp, int nfserr = 0; fh = fh_copy(&resp->fh, &argp->fh); - nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); + nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); if (!nfserr) { nfserr = nfserrno( nfsd_set_posix_acl( -- cgit v1.2.3 From 391eadeec836463a4e6e3843953bbe40f6522593 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Tue, 20 Dec 2005 07:23:47 +0100 Subject: [PATCH] Fix build with CONFIG_PCI_MMCONFIG Now needs to include the type 1 functions ("direct") too. Reported by Pavel Roskin Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds --- arch/i386/pci/Makefile | 2 +- arch/x86_64/pci/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile index ead6122dd06..5461d4d5ea1 100644 --- a/arch/i386/pci/Makefile +++ b/arch/i386/pci/Makefile @@ -1,7 +1,7 @@ obj-y := i386.o obj-$(CONFIG_PCI_BIOS) += pcbios.o -obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o +obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o obj-$(CONFIG_PCI_DIRECT) += direct.o pci-y := fixup.o diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile index bb34e5ef916..a8f75a2a0f6 100644 --- a/arch/x86_64/pci/Makefile +++ b/arch/x86_64/pci/Makefile @@ -11,7 +11,7 @@ obj-y += fixup.o obj-$(CONFIG_ACPI) += acpi.o obj-y += legacy.o irq.o common.o # mmconfig has a 64bit special -obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o +obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o obj-$(CONFIG_NUMA) += k8-bus.o -- cgit v1.2.3 From bb44f116a14c4c932f15c79acfafd46bcb43ca9a Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Tue, 20 Dec 2005 11:54:17 +0100 Subject: [PATCH] fix spinlock-debugging smp_processor_id() usage When a spinlock debugging check hits, we print the CPU number as an informational thing - but there is no guarantee that preemption is off at that point - hence we should use raw_smp_processor_id(). Otherwise DEBUG_PREEMPT will print a warning. With this fix the warning goes away and only the spinlock-debugging info is printed. Signed-off-by: Ingo Molnar Signed-off-by: Linus Torvalds --- lib/spinlock_debug.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 906ad101eab..dcd4be9bd4e 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c @@ -20,7 +20,8 @@ static void spin_bug(spinlock_t *lock, const char *msg) if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) owner = lock->owner; printk("BUG: spinlock %s on CPU#%d, %s/%d\n", - msg, smp_processor_id(), current->comm, current->pid); + msg, raw_smp_processor_id(), + current->comm, current->pid); printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n", lock, lock->magic, owner ? owner->comm : "", @@ -78,8 +79,8 @@ static void __spin_lock_debug(spinlock_t *lock) if (print_once) { print_once = 0; printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n", - smp_processor_id(), current->comm, current->pid, - lock); + raw_smp_processor_id(), current->comm, + current->pid, lock); dump_stack(); } } @@ -120,7 +121,8 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) if (xchg(&print_once, 0)) { printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg, - smp_processor_id(), current->comm, current->pid, lock); + raw_smp_processor_id(), current->comm, + current->pid, lock); dump_stack(); #ifdef CONFIG_SMP /* @@ -148,8 +150,8 @@ static void __read_lock_debug(rwlock_t *lock) if (print_once) { print_once = 0; printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n", - smp_processor_id(), current->comm, current->pid, - lock); + raw_smp_processor_id(), current->comm, + current->pid, lock); dump_stack(); } } @@ -220,8 +222,8 @@ static void __write_lock_debug(rwlock_t *lock) if (print_once) { print_once = 0; printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n", - smp_processor_id(), current->comm, current->pid, - lock); + raw_smp_processor_id(), current->comm, + current->pid, lock); dump_stack(); } } -- cgit v1.2.3 From a9c9dff1bc64750c81ee99779164d304c35d2ff3 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 20 Dec 2005 14:53:05 -0800 Subject: [SPARC64]: Stop putting -finline-limit=XXX into CFLAGS It was a stupid workaround for the "static inline" vs. "extern inline" issues of long ago, and it is what causes schedule() to be inlined like crazy into kernel/sched.c when -Os is specified. MIPS and S390 should probably do the same. Now CC_OPTIMIZE_FOR_SIZE can be safely used on sparc64 once more. Signed-off-by: David S. Miller --- arch/sparc64/Makefile | 5 ----- init/Kconfig | 1 - 2 files changed, 6 deletions(-) diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile index 43fe382da07..cad10c5b83d 100644 --- a/arch/sparc64/Makefile +++ b/arch/sparc64/Makefile @@ -17,7 +17,6 @@ CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow) NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi) UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; ) -INLINE_LIMIT := $(call cc-option-yn, -m64 -finline-limit=100000) export NEW_GCC @@ -49,10 +48,6 @@ else AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL) endif -ifeq ($(INLINE_LIMIT),y) - CFLAGS := $(CFLAGS) -finline-limit=100000 -endif - ifeq ($(CONFIG_MCOUNT),y) CFLAGS := $(CFLAGS) -pg endif diff --git a/init/Kconfig b/init/Kconfig index 6c5dbedc6e9..9fc0759fa94 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -260,7 +260,6 @@ config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size (Look out for broken compilers!)" default y depends on ARM || H8300 || EXPERIMENTAL - depends on !SPARC64 help Enabling this option will pass "-Os" instead of "-O2" to gcc resulting in a smaller kernel. -- cgit v1.2.3 From fd30fc3256824f03c2ff9317269d66f72f7042ca Mon Sep 17 00:00:00 2001 From: Tom Zanussi Date: Tue, 20 Dec 2005 13:10:22 -0600 Subject: [PATCH] relayfs: remove warning printk() in relay_switch_subbuf() There's currently a diagnostic printk in relay_switch_subbuf() meant as a warning if you accidentally try to log an event larger than the sub-buffer size. The problem is if this happens while logging from somewhere it's not safe to be doing printks, such as in the scheduler, you can end up with a deadlock. This patch removes the warning from relay_switch_subbuf() and instead prints some diagnostic info when the channel is closed. Thanks to Mathieu Desnoyers for pointing out the problem and suggesting a fix. Signed-off-by: Tom Zanussi Signed-off-by: Linus Torvalds --- fs/relayfs/relay.c | 8 ++++++-- include/linux/relayfs_fs.h | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c index 16446a15c96..2a6f7f12b7f 100644 --- a/fs/relayfs/relay.c +++ b/fs/relayfs/relay.c @@ -333,8 +333,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length) return length; toobig: - printk(KERN_WARNING "relayfs: event too large (%Zd)\n", length); - WARN_ON(1); + buf->chan->last_toobig = length; return 0; } @@ -399,6 +398,11 @@ void relay_close(struct rchan *chan) relay_close_buf(chan->buf[i]); } + if (chan->last_toobig) + printk(KERN_WARNING "relayfs: one or more items not logged " + "[item size (%Zd) > sub-buffer size (%Zd)]\n", + chan->last_toobig, chan->subbuf_size); + kref_put(&chan->kref, relay_destroy_channel); } diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h index cfafc3e76bc..fb7e8073732 100644 --- a/include/linux/relayfs_fs.h +++ b/include/linux/relayfs_fs.h @@ -20,9 +20,9 @@ #include /* - * Tracks changes to rchan_buf struct + * Tracks changes to rchan/rchan_buf structs */ -#define RELAYFS_CHANNEL_VERSION 5 +#define RELAYFS_CHANNEL_VERSION 6 /* * Per-cpu relay channel buffer @@ -60,6 +60,7 @@ struct rchan struct rchan_callbacks *cb; /* client callbacks */ struct kref kref; /* channel refcount */ void *private_data; /* for user-defined data */ + size_t last_toobig; /* tried to log event > subbuf size */ struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */ }; -- cgit v1.2.3 From 05465fd5622202d65634b3a9a8bcc9cbb384a82a Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Thu, 8 Dec 2005 15:37:00 -0500 Subject: [ACPI] increase owner_id limit to 64 from 32 This is an interim patch until changes in an updated ACPICA core increase the limit to 255. Signed-off-by: Alex Williamson Signed-off-by: Len Brown --- drivers/acpi/utilities/utmisc.c | 18 +++++++++--------- include/acpi/acglobal.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 0c5abc536c7..b886780f9de 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -84,14 +84,14 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) /* Find a free owner ID */ - for (i = 0; i < 32; i++) { - if (!(acpi_gbl_owner_id_mask & (1 << i))) { + for (i = 0; i < 64; i++) { + if (!(acpi_gbl_owner_id_mask & (1ULL << i))) { ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Current owner_id mask: %8.8X New ID: %2.2X\n", + "Current owner_id mask: %16.16lX New ID: %2.2X\n", acpi_gbl_owner_id_mask, (unsigned int)(i + 1))); - acpi_gbl_owner_id_mask |= (1 << i); + acpi_gbl_owner_id_mask |= (1ULL << i); *owner_id = (acpi_owner_id) (i + 1); goto exit; } @@ -106,7 +106,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) */ *owner_id = 0; status = AE_OWNER_ID_LIMIT; - ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n")); + ACPI_REPORT_ERROR(("Could not allocate new owner_id (64 max), AE_OWNER_ID_LIMIT\n")); exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); @@ -123,7 +123,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * control method or unloading a table. Either way, we would * ignore any error anyway. * - * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32 + * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 64 * ******************************************************************************/ @@ -140,7 +140,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Zero is not a valid owner_iD */ - if ((owner_id == 0) || (owner_id > 32)) { + if ((owner_id == 0) || (owner_id > 64)) { ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); return_VOID; } @@ -158,8 +158,8 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) /* Free the owner ID only if it is valid */ - if (acpi_gbl_owner_id_mask & (1 << owner_id)) { - acpi_gbl_owner_id_mask ^= (1 << owner_id); + if (acpi_gbl_owner_id_mask & (1ULL << owner_id)) { + acpi_gbl_owner_id_mask ^= (1ULL << owner_id); } (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index e9c2790139e..4ab2ca18b8d 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h @@ -211,7 +211,7 @@ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; -ACPI_EXTERN u32 acpi_gbl_owner_id_mask; +ACPI_EXTERN u64 acpi_gbl_owner_id_mask; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; ACPI_EXTERN u16 acpi_gbl_global_lock_handle; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; -- cgit v1.2.3 From 58c4fb86eabcbc385d954843a635b7f4327be6b0 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 21 Dec 2005 22:56:42 +0900 Subject: [IPV6]: Flag RTF_ANYCAST for anycast routes. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/ipv6_route.h | 1 + net/ipv6/route.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h index e2f93503801..d7c41d1d706 100644 --- a/include/linux/ipv6_route.h +++ b/include/linux/ipv6_route.h @@ -18,6 +18,7 @@ fallback, no routers on link */ #define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ #define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ +#define RTF_ANYCAST 0x00100000 /* Anycast */ #define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ #define RTF_EXPIRES 0x00400000 diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7c68bfbee36..66140f13d11 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -413,11 +413,14 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr, rt = ip6_rt_copy(ort); if (rt) { - ipv6_addr_copy(&rt->rt6i_dst.addr, daddr); - - if (!(rt->rt6i_flags&RTF_GATEWAY)) + if (!(rt->rt6i_flags&RTF_GATEWAY)) { + if (rt->rt6i_dst.plen != 128 && + ipv6_addr_equal(&rt->rt6i_dst.addr, daddr)) + rt->rt6i_flags |= RTF_ANYCAST; ipv6_addr_copy(&rt->rt6i_gateway, daddr); + } + ipv6_addr_copy(&rt->rt6i_dst.addr, daddr); rt->rt6i_dst.plen = 128; rt->rt6i_flags |= RTF_CACHE; rt->u.dst.flags |= DST_HOST; @@ -1413,7 +1416,9 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, rt->u.dst.obsolete = -1; rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; - if (!anycast) + if (anycast) + rt->rt6i_flags |= RTF_ANYCAST; + else rt->rt6i_flags |= RTF_LOCAL; rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway); if (rt->rt6i_nexthop == NULL) { -- cgit v1.2.3 From 8de3351e6e0a1081fbf6864ae37839e327699a08 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 21 Dec 2005 22:57:06 +0900 Subject: [IPV6]: Try not to send icmp to anycast address. Signed-off-by: YOSHIFUJI Hideaki --- net/ipv6/icmp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 34a332225c1..6ec6a2b549b 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -328,8 +328,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, iif = skb->dev->ifindex; /* - * Must not send if we know that source is Anycast also. - * for now we don't know that. + * Must not send error if the source does not uniquely + * identify a single node (RFC2463 Section 2.4). + * We check unspecified / multicast addresses here, + * and anycast addresses will be checked later. */ if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) { LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: addr_any/mcast source\n"); @@ -373,6 +375,16 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, err = ip6_dst_lookup(sk, &dst, &fl); if (err) goto out; + + /* + * We won't send icmp if the destination is known + * anycast. + */ + if (((struct rt6_info *)dst)->rt6i_flags & RTF_ANYCAST) { + LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: acast source\n"); + goto out_dst_release; + } + if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) goto out; -- cgit v1.2.3 From 3c21edbd113788b110116141c8078623a0900b6a Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 21 Dec 2005 22:57:24 +0900 Subject: [IPV6]: Defer IPv6 device initialization until the link becomes ready. NETDEV_UP might be sent even if the link attached to the interface was not ready. DAD does not make sense in such case, so we won't do so. After interface Signed-off-by: YOSHIFUJI Hideaki --- include/net/if_inet6.h | 1 + net/ipv6/addrconf.c | 74 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index e97a9accb71..d8234f9bd4c 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -24,6 +24,7 @@ #define IF_RA_MANAGED 0x40 #define IF_RA_RCVD 0x20 #define IF_RS_SENT 0x10 +#define IF_READY 0x80000000 /* prefix flags */ #define IF_PREFIX_ONLINK 0x01 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4ea8cf7c0cc..d012f6ac704 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -388,6 +388,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) } #endif + if (netif_carrier_ok(dev)) + ndev->if_flags |= IF_READY; + write_lock_bh(&addrconf_lock); dev->ip6_ptr = ndev; write_unlock_bh(&addrconf_lock); @@ -1215,10 +1218,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) /* Gets referenced address, destroys ifaddr */ -void addrconf_dad_failure(struct inet6_ifaddr *ifp) +void addrconf_dad_stop(struct inet6_ifaddr *ifp) { - if (net_ratelimit()) - printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name); if (ifp->flags&IFA_F_PERMANENT) { spin_lock_bh(&ifp->lock); addrconf_del_timer(ifp); @@ -1244,6 +1245,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) ipv6_del_addr(ifp); } +void addrconf_dad_failure(struct inet6_ifaddr *ifp) +{ + if (net_ratelimit()) + printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name); + addrconf_dad_stop(ifp); +} /* Join to solicited addr multicast group. */ @@ -2136,6 +2143,37 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, switch(event) { case NETDEV_UP: + case NETDEV_CHANGE: + if (event == NETDEV_UP) { + if (!netif_carrier_ok(dev)) { + /* device is not ready yet. */ + printk(KERN_INFO + "ADDRCONF(NETDEV_UP): %s: " + "link is not ready\n", + dev->name); + break; + } + } else { + if (!netif_carrier_ok(dev)) { + /* device is still not ready. */ + break; + } + + if (idev) { + if (idev->if_flags & IF_READY) { + /* device is already configured. */ + break; + } + idev->if_flags |= IF_READY; + } + + printk(KERN_INFO + "ADDRCONF(NETDEV_CHANGE): %s: " + "link becomes ready\n", + dev->name); + + } + switch(dev->type) { case ARPHRD_SIT: addrconf_sit_config(dev); @@ -2186,8 +2224,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, */ addrconf_ifdown(dev, event != NETDEV_DOWN); break; - case NETDEV_CHANGE: - break; + case NETDEV_CHANGENAME: #ifdef CONFIG_SYSCTL if (idev) { @@ -2268,7 +2305,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) /* Step 3: clear flags for stateless addrconf */ if (how != 1) - idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD); + idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); /* Step 4: clear address list */ #ifdef CONFIG_IPV6_PRIVACY @@ -2377,11 +2414,20 @@ out: /* * Duplicate Address Detection */ +static void addrconf_dad_kick(struct inet6_ifaddr *ifp) +{ + unsigned long rand_num; + struct inet6_dev *idev = ifp->idev; + + rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); + ifp->probes = idev->cnf.dad_transmits; + addrconf_mod_timer(ifp, AC_DAD, rand_num); +} + static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) { struct inet6_dev *idev = ifp->idev; struct net_device *dev = idev->dev; - unsigned long rand_num; addrconf_join_solict(dev, &ifp->addr); @@ -2390,7 +2436,6 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) flags); net_srandom(ifp->addr.s6_addr32[3]); - rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); read_lock_bh(&idev->lock); if (ifp->dead) @@ -2407,8 +2452,17 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) return; } - ifp->probes = idev->cnf.dad_transmits; - addrconf_mod_timer(ifp, AC_DAD, rand_num); + if (idev->if_flags & IF_READY) + addrconf_dad_kick(ifp); + else { + /* + * If the defice is not ready: + * - keep it tentative if it is a permanent address. + * - otherwise, kill it. + */ + in6_ifa_hold(ifp); + addrconf_dad_stop(ifp); + } spin_unlock_bh(&ifp->lock); out: -- cgit v1.2.3 From c5e33bddd3c798f681f8f3027270127be6b61a3b Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 21 Dec 2005 22:57:44 +0900 Subject: [IPV6]: Run DAD when the link becomes ready. If the link was not available when the interface was created, run DAD for pending tentative addresses when the link becomes ready. Signed-off-by: YOSHIFUJI Hideaki --- net/ipv6/addrconf.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d012f6ac704..f6ead6a843e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -137,6 +137,7 @@ static int addrconf_ifdown(struct net_device *dev, int how); static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags); static void addrconf_dad_timer(unsigned long data); static void addrconf_dad_completed(struct inet6_ifaddr *ifp); +static void addrconf_dad_run(struct inet6_dev *idev); static void addrconf_rs_timer(unsigned long data); static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); @@ -418,6 +419,7 @@ static struct inet6_dev * ipv6_find_idev(struct net_device *dev) if ((idev = ipv6_add_dev(dev)) == NULL) return NULL; } + if (dev->flags&IFF_UP) ipv6_mc_up(idev); return idev; @@ -2140,6 +2142,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, { struct net_device *dev = (struct net_device *) data; struct inet6_dev *idev = __in6_dev_get(dev); + int run_pending = 0; switch(event) { case NETDEV_UP: @@ -2172,6 +2175,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, "link becomes ready\n", dev->name); + run_pending = 1; } switch(dev->type) { @@ -2190,6 +2194,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event, break; }; if (idev) { + if (run_pending) + addrconf_dad_run(idev); + /* If the MTU changed during the interface down, when the interface up, the changed MTU must be reflected in the idev as well as routers. @@ -2546,6 +2553,22 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp) } } +static void addrconf_dad_run(struct inet6_dev *idev) { + struct inet6_ifaddr *ifp; + + read_lock_bh(&idev->lock); + for (ifp = idev->addr_list; ifp; ifp = ifp->if_next) { + spin_lock_bh(&ifp->lock); + if (!(ifp->flags & IFA_F_TENTATIVE)) { + spin_unlock_bh(&ifp->lock); + continue; + } + spin_unlock_bh(&ifp->lock); + addrconf_dad_kick(ifp); + } + read_unlock_bh(&idev->lock); +} + #ifdef CONFIG_PROC_FS struct if6_iter_state { int bucket; -- cgit v1.2.3 From 6b3ae80a63e47f6e97d68a1ddd520e3509e62821 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 21 Dec 2005 22:58:01 +0900 Subject: [IPV6]: Don't select a tentative address as a source address. A tentative address is not considered "assigned to an interface" in the traditional sense (RFC2462 Section 4). Don't try to select such an address for the source address. Signed-off-by: YOSHIFUJI Hideaki --- net/ipv6/addrconf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f6ead6a843e..fd03c394436 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -908,11 +908,18 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev, score.addr_type = __ipv6_addr_type(&ifa->addr); - /* Rule 0: Candidate Source Address (section 4) + /* Rule 0: + * - Tentative Address (RFC2462 section 5.4) + * - A tentative address is not considered + * "assigned to an interface" in the traditional + * sense. + * - Candidate Source Address (section 4) * - In any case, anycast addresses, multicast * addresses, and the unspecified address MUST * NOT be included in a candidate set. */ + if (ifa->flags & IFA_F_TENTATIVE) + continue; if (unlikely(score.addr_type == IPV6_ADDR_ANY || score.addr_type & IPV6_ADDR_MULTICAST)) { LIMIT_NETDEBUG(KERN_DEBUG -- cgit v1.2.3 From 23f9b317e0ba4fbc5fc9524275d0105fa87e2027 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 21 Dec 2005 02:27:50 +0100 Subject: [PATCH] include/linux/irq.h: #include Jan's crosscompile page [1] shows, that one regression in 2.6.15-rc is that the v850 defconfig does no longer compile. The compile error is: <-- snip --> ... CC arch/v850/kernel/setup.o In file included from /usr/src/ctest/rc/kernel/arch/v850/kernel/setup.c:17: /usr/src/ctest/rc/kernel/include/linux/irq.h:13:43: asm/smp.h: No such file or directory make[2]: *** [arch/v850/kernel/setup.o] Error 1 <-- snip --> The #include in irq.h was intruduced in 2.6.15-rc. Since include/linux/irq.h needs code from asm/smp.h only in the CONFIG_SMP=y case and linux/smp.h #include's asm/smp.h only in the CONFIG_SMP=y case, I'm suggesting this patch to #include in irq.h. I've tested the compilation with both CONFIG_SMP=y and CONFIG_SMP=n on i386. Signed-off-by: Adrian Bunk Acked-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/irq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index c516382fbec..f04ba20712a 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -10,7 +10,7 @@ */ #include -#include /* cpu_online_map */ +#include #if !defined(CONFIG_ARCH_S390) -- cgit v1.2.3 From 28120be5d6830cd7c7777d8bf570bdb20abef58a Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Wed, 21 Dec 2005 14:28:06 -0800 Subject: [PATCH] USB Storage: Force starget->scsi_level in usb-storage scsiglue.c When the usb-storage module forces sdev->scsi_level to SCSI_2, it should also force starget->scsi_level to the same value. Otherwise, the SCSI layer may attempt to issue SCSI-3 commands to the device, such as REPORT LUNS, which it cannot handle. This can prevent the device from working with Linux. The AMS Venus DS3 DS2316SU2S SATA-to-SATA+USB enclosure, based on the Oxford Semiconductor OXU921S chip, requires this patch to function correctly on Linux. The enclosure reports a SCSI-3 SPC-2 command set level, but does not correctly handle the REPORT LUNS SCSI command - probably due to a bug in its firmware. It seems likely that other USB storage enclosures with similar bugs will also benefit from this patch. Tony Lindgren collaborated in the development of this patch. Signed-off-by: Paul Walmsley Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/scsiglue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 4837524eada..4ef5527028c 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -109,7 +109,7 @@ static int slave_configure(struct scsi_device *sdev) * data comes from. */ if (sdev->scsi_level < SCSI_2) - sdev->scsi_level = SCSI_2; + sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; /* According to the technical support people at Genesys Logic, * devices using their chips have problems transferring more than @@ -162,7 +162,7 @@ static int slave_configure(struct scsi_device *sdev) * a Get-Max-LUN request, we won't lose much by setting the * revision level down to 2. The only devices that would be * affected are those with sparse LUNs. */ - sdev->scsi_level = SCSI_2; + sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable * Hardware Error) when any low-level error occurs, -- cgit v1.2.3 From 5a9191ff683ce4ebfd2c6a15e2989f5b1f420321 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Wed, 21 Dec 2005 14:28:11 -0800 Subject: [PATCH] usbcore: allow suspend/resume even if drivers don't support it This patch (as618) changes usbcore to prevent derailing the suspend/resume sequence when a USB driver doesn't include support for it. This is a workaround rather than a true fix; the core needs to be changed so that URB submissions from suspended drivers can be refused and outstanding URBs cancelled. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/usb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index e197ce9353d..e80ef946782 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -1432,7 +1432,8 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message) mark_quiesced(intf); } else { // FIXME else if there's no suspend method, disconnect... - dev_warn(dev, "no %s?\n", "suspend"); + dev_warn(dev, "no suspend for driver %s?\n", driver->name); + mark_quiesced(intf); status = 0; } return status; @@ -1460,8 +1461,10 @@ static int usb_generic_resume(struct device *dev) } if ((dev->driver == NULL) || - (dev->driver_data == &usb_generic_driver_data)) + (dev->driver_data == &usb_generic_driver_data)) { + dev->power.power_state.event = PM_EVENT_FREEZE; return 0; + } intf = to_usb_interface(dev); driver = to_usb_driver(dev->driver); @@ -1481,7 +1484,7 @@ static int usb_generic_resume(struct device *dev) mark_quiesced(intf); } } else - dev_warn(dev, "no %s?\n", "resume"); + dev_warn(dev, "no resume for driver %s?\n", driver->name); return 0; } -- cgit v1.2.3 From c7ac6b42ffba28c350cbcd48268f46689f6eb1cc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 21 Dec 2005 14:52:32 -0800 Subject: Initialize drivers/media/video/saa7134 late When compiled-in, make sure the sound system has initialized before these drivers do. Reported by Adrian Bunk (The right fix would be to make the sound core use "subsys_initcall()" and thus initialize before all normal drivers, but this is the quick and limited safe fix for 2.6.15). Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/saa7134-alsa.c | 3 ++- drivers/media/video/saa7134/saa7134-oss.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 953d5fec82d..6752dd1c1e8 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -1028,7 +1028,8 @@ static void saa7134_alsa_exit(void) return; } -module_init(saa7134_alsa_init); +/* We initialize this late, to make sure the sound system is up and running */ +late_initcall(saa7134_alsa_init); module_exit(saa7134_alsa_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ricardo Cerqueira"); diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 513a699a6df..c450d57b294 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -1002,7 +1002,8 @@ static void saa7134_oss_exit(void) return; } -module_init(saa7134_oss_init); +/* We initialize this late, to make sure the sound system is up and running */ +late_initcall(saa7134_oss_init); module_exit(saa7134_oss_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); -- cgit v1.2.3 From 0d77d59f6293438f25e0560172699c0d3e4ef5ac Mon Sep 17 00:00:00 2001 From: Mika Kukkonen Date: Wed, 21 Dec 2005 18:38:26 -0800 Subject: [NETROM]: Fix three if-statements in nr_state1_machine() I found these while compiling with extra gcc warnings; considering the indenting surely they are not intentional? Signed-off-by: Mika Kukkonen Signed-off-by: Ralf Baechle Signed-off-by: David S. Miller --- net/netrom/nr_in.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c index 004e8599b8f..a7d88b5ad75 100644 --- a/net/netrom/nr_in.c +++ b/net/netrom/nr_in.c @@ -99,7 +99,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, break; case NR_RESET: - if (sysctl_netrom_reset_circuit); + if (sysctl_netrom_reset_circuit) nr_disconnect(sk, ECONNRESET); break; @@ -130,7 +130,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb, break; case NR_RESET: - if (sysctl_netrom_reset_circuit); + if (sysctl_netrom_reset_circuit) nr_disconnect(sk, ECONNRESET); break; @@ -265,7 +265,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype break; case NR_RESET: - if (sysctl_netrom_reset_circuit); + if (sysctl_netrom_reset_circuit) nr_disconnect(sk, ECONNRESET); break; -- cgit v1.2.3 From 7eb1b3d372a53fe9220b9e3b579886db0fe2f897 Mon Sep 17 00:00:00 2001 From: Mika Kukkonen Date: Wed, 21 Dec 2005 18:39:49 -0800 Subject: [VLAN]: Add two missing checks to vlan_ioctl_handler() In vlan_ioctl_handler() the code misses couple checks for error return values. Signed-off-by: Mika Kukkonen Signed-off-by: David S. Miller --- net/8021q/vlan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 91e412b0ab0..67465b65abe 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -753,6 +753,8 @@ static int vlan_ioctl_handler(void __user *arg) break; case GET_VLAN_REALDEV_NAME_CMD: err = vlan_dev_get_realdev_name(args.device1, args.u.device2); + if (err) + goto out; if (copy_to_user(arg, &args, sizeof(struct vlan_ioctl_args))) { err = -EFAULT; @@ -761,6 +763,8 @@ static int vlan_ioctl_handler(void __user *arg) case GET_VLAN_VID_CMD: err = vlan_dev_get_vid(args.device1, &vid); + if (err) + goto out; args.u.VID = vid; if (copy_to_user(arg, &args, sizeof(struct vlan_ioctl_args))) { @@ -774,7 +778,7 @@ static int vlan_ioctl_handler(void __user *arg) __FUNCTION__, args.cmd); return -EINVAL; }; - +out: return err; } -- cgit v1.2.3 From 1d1428045c54ef3d172d480806e2066dde0b4b76 Mon Sep 17 00:00:00 2001 From: Kristian Slavov Date: Wed, 21 Dec 2005 18:47:24 -0800 Subject: [IPV6]: Fix address deletion If you add more than one IPv6 address belonging to the same prefix and delete the address that was last added, routing table entry for that prefix is also deleted. Tested on 2.6.14.4 To reproduce: ip addr add 3ffe::1/64 dev eth0 ip addr add 3ffe::2/64 dev eth0 /* wait DAD */ sleep 1 ip addr del 3ffe::2/64 dev eth0 ip -6 route (route to 3ffe::/64 should be gone) In ipv6_del_addr(), if ifa == ifp, we set ifa->if_next to NULL, and later assign ifap = &ifa->if_next, effectively terminating the for-loop. This prevents us from checking if there are other addresses using the same prefix that are valid, and thus resulting in deletion of the prefix. This applies only if the first entry in idev->addr_list is the address to be deleted. Signed-off-by: Kristian Slavov Acked-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4ea8cf7c0cc..e717a034c95 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -634,8 +634,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) } #endif - for (ifap = &idev->addr_list; (ifa=*ifap) != NULL; - ifap = &ifa->if_next) { + for (ifap = &idev->addr_list; (ifa=*ifap) != NULL;) { if (ifa == ifp) { *ifap = ifa->if_next; __in6_ifa_put(ifp); @@ -643,6 +642,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) if (!(ifp->flags & IFA_F_PERMANENT) || onlink > 0) break; deleted = 1; + continue; } else if (ifp->flags & IFA_F_PERMANENT) { if (ipv6_prefix_equal(&ifa->addr, &ifp->addr, ifp->prefix_len)) { @@ -666,6 +666,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) } } } + ifap = &ifa->if_next; } write_unlock_bh(&idev->lock); -- cgit v1.2.3 From 4c7e6895027362889422e5dc437dc3238b6b4745 Mon Sep 17 00:00:00 2001 From: Ian McDonald Date: Wed, 21 Dec 2005 19:02:39 -0800 Subject: [DCCP]: Comment typo I hope to actually change this behaviour shortly but this will help anybody grepping code at present. Signed-off-by: Ian McDonald Signed-off-by: David S. Miller --- net/dccp/ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index ca03521112c..656e13e38cf 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -1251,7 +1251,7 @@ static int dccp_v4_destroy_sock(struct sock *sk) struct dccp_sock *dp = dccp_sk(sk); /* - * DCCP doesn't use sk_qrite_queue, just sk_send_head + * DCCP doesn't use sk_write_queue, just sk_send_head * for retransmissions */ if (sk->sk_send_head != NULL) { -- cgit v1.2.3 From 7bb9529602f8bb41a92275825b808a42ed33e5be Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 20 Dec 2005 18:26:26 -0200 Subject: V4L/DVB (3200): Fix saa7134 ALSA/OSS collisions - When ALSA or OSS are loaded, check if the other is present Fixed hotplug notifiers cleanup on module removal - The saa7134 DMA sound modules now have their own Kconfig entries, and if built statically enforce exclusivity - SND_PCM_OSS isn't necessary for the OSS driver Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/Kconfig | 26 ++++++++++++++++++++++++-- drivers/media/video/saa7134/Makefile | 7 +++++-- drivers/media/video/saa7134/saa7134-alsa.c | 13 ++++++++++--- drivers/media/video/saa7134/saa7134-oss.c | 15 ++++++++++++--- 4 files changed, 51 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index c512c4411b3..c0f604a6fe4 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -1,11 +1,10 @@ config VIDEO_SAA7134 tristate "Philips SAA7134 support" - depends on VIDEO_DEV && PCI && I2C && SOUND && SND + depends on VIDEO_DEV && PCI && I2C select VIDEO_BUF select VIDEO_IR select VIDEO_TUNER select CRC32 - select SND_PCM_OSS ---help--- This is a video4linux driver for Philips SAA713x based TV cards. @@ -13,6 +12,29 @@ config VIDEO_SAA7134 To compile this driver as a module, choose M here: the module will be called saa7134. +config VIDEO_SAA7134_ALSA + tristate "Philips SAA7134 DMA audio support" + depends on VIDEO_SAA7134 && SOUND && SND && (!VIDEO_SAA7134_OSS || VIDEO_SAA7134_OSS = m) + select SND_PCM_OSS + ---help--- + This is a video4linux driver for direct (DMA) audio in + Philips SAA713x based TV cards using ALSA + + To compile this driver as a module, choose M here: the + module will be called saa7134-alsa. + +config VIDEO_SAA7134_OSS + tristate "Philips SAA7134 DMA audio support (OSS, DEPRECATED)" + depends on VIDEO_SAA7134 && SOUND_PRIME && (!VIDEO_SAA7134_ALSA || VIDEO_SAA7134_ALSA = m) + ---help--- + This is a video4linux driver for direct (DMA) audio in + Philips SAA713x based TV cards using OSS + + This is deprecated in favor of the ALSA module + + To compile this driver as a module, choose M here: the + module will be called saa7134-oss. + config VIDEO_SAA7134_DVB tristate "DVB/ATSC Support for saa7134 based TV cards" depends on VIDEO_SAA7134 && DVB_CORE diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index 134f83a9621..1ba998424bb 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile @@ -4,8 +4,11 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \ saa7134-video.o saa7134-input.o obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \ - saa6752hs.o saa7134-alsa.o \ - saa7134-oss.o + saa6752hs.o + +obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o +obj-$(CONFIG_VIDEO_SAA7134_OSS) += saa7134-oss.o + obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o EXTRA_CFLAGS += -I$(src)/.. diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 6752dd1c1e8..ade05f75fdb 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -989,6 +989,14 @@ static int saa7134_alsa_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; + if (!dmasound_init && !dmasound_exit) { + dmasound_init = alsa_device_init; + dmasound_exit = alsa_device_exit; + } else { + printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); + return -EBUSY; + } + printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); list_for_each(list,&saa7134_devlist) { @@ -1001,9 +1009,6 @@ static int saa7134_alsa_init(void) } } - dmasound_init = alsa_device_init; - dmasound_exit = alsa_device_exit; - if (dev == NULL) printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); @@ -1023,6 +1028,8 @@ static void saa7134_alsa_exit(void) snd_card_free(snd_saa7134_cards[idx]); } + dmasound_init = NULL; + dmasound_exit = NULL; printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); return; diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index c450d57b294..8badd2a9cb2 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -959,8 +959,17 @@ static int saa7134_oss_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; + if (!dmasound_init && !dmasound_exit) { + dmasound_init = oss_device_init; + dmasound_exit = oss_device_exit; + } else { + printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); + return -EBUSY; + } + printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n"); + list_for_each(list,&saa7134_devlist) { dev = list_entry(list, struct saa7134_dev, devlist); if (dev->dmasound.priv_data == NULL) { @@ -974,9 +983,6 @@ static int saa7134_oss_init(void) if (dev == NULL) printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); - dmasound_init = oss_device_init; - dmasound_exit = oss_device_exit; - return 0; } @@ -997,6 +1003,9 @@ static void saa7134_oss_exit(void) } + dmasound_init = NULL; + dmasound_exit = NULL; + printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); return; -- cgit v1.2.3 From 515432aa7ae75ea493099f38adc14a99436fa1ac Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 20 Dec 2005 09:48:29 -0200 Subject: V4L/DVB (3191): Fix CC output - CC data was swapped the wrong way around. - Enabling CC disabled XDS and vice versa: these two should be independent from one another. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7127.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 3428e1ed003..c36f014f1fd 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -389,7 +389,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data *data) { struct saa7127_state *state = i2c_get_clientdata(client); - u16 cc = data->data[0] << 8 | data->data[1]; + u16 cc = data->data[1] << 8 | data->data[0]; int enable = (data->line != 0); if (enable && (data->field != 0 || data->line != 21)) @@ -397,7 +397,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data if (state->cc_enable != enable) { saa7127_dbg("Turn CC %s\n", enable ? "on" : "off"); saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, - (enable << 6) | 0x11); + (state->xds_enable << 7) | (enable << 6) | 0x11); state->cc_enable = enable; } if (!enable) @@ -423,7 +423,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat if (state->xds_enable != enable) { saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off"); saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, - (enable << 7) | 0x11); + (enable << 7) | (state->cc_enable << 6) | 0x11); state->xds_enable = enable; } if (!enable) -- cgit v1.2.3 From 8b1af56b29b9b81538b4d0d4fd9515618618ead1 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 22 Dec 2005 21:55:37 +1100 Subject: powerpc: Fix i8259 cascade on pSeries with XICS interrupt controller It turns out that commit f9bd170a87948a9e077149b70fb192c563770fdf broke the cascade from XICS to i8259 on pSeries machines; specifically we ended up not ever doing the EOI on the XICS for the cascade. The result was that interrupts from the serial ports (and presumably any other devices using ISA interrupts) didn't get through. This fixes it and also simplifies the code, by doing the EOI on the XICS in the xics_get_irq routine after reading and acking the interrupt on the i8259. Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/pseries/xics.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index 72ac18067ec..0377decc071 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c @@ -48,11 +48,6 @@ static struct hw_interrupt_type xics_pic = { .set_affinity = xics_set_affinity }; -static struct hw_interrupt_type xics_8259_pic = { - .typename = " XICS/8259", - .ack = xics_mask_and_ack_irq, -}; - /* This is used to map real irq numbers to virtual */ static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC); @@ -367,12 +362,7 @@ int xics_get_irq(struct pt_regs *regs) /* for sanity, this had better be < NR_IRQS - 16 */ if (vec == xics_irq_8259_cascade_real) { irq = i8259_irq(regs); - if (irq == -1) { - /* Spurious cascaded interrupt. Still must ack xics */ - xics_end_irq(irq_offset_up(xics_irq_8259_cascade)); - - irq = -1; - } + xics_end_irq(irq_offset_up(xics_irq_8259_cascade)); } else if (vec == XICS_IRQ_SPURIOUS) { irq = -1; } else { @@ -542,6 +532,7 @@ nextnode: xics_irq_8259_cascade_real = *ireg; xics_irq_8259_cascade = virt_irq_create_mapping(xics_irq_8259_cascade_real); + i8259_init(0, 0); of_node_put(np); } @@ -565,12 +556,7 @@ nextnode: #endif /* CONFIG_SMP */ } - xics_8259_pic.enable = i8259_pic.enable; - xics_8259_pic.disable = i8259_pic.disable; - xics_8259_pic.end = i8259_pic.end; - for (i = 0; i < 16; ++i) - get_irq_desc(i)->handler = &xics_8259_pic; - for (; i < NR_IRQS; ++i) + for (i = irq_offset_value(); i < NR_IRQS; ++i) get_irq_desc(i)->handler = &xics_pic; xics_setup_cpu(); @@ -590,7 +576,6 @@ static int __init xics_setup_i8259(void) no_action, 0, "8259 cascade", NULL)) printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 " "cascade\n"); - i8259_init(0, 0); } return 0; } -- cgit v1.2.3 From 9b78a82c1cf19aa813bdaa184fa840a3ba811750 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 Dec 2005 07:39:48 -0800 Subject: [IPSEC]: Fix policy updates missed by sockets The problem is that when new policies are inserted, sockets do not see the update (but all new route lookups do). This bug is related to the SA insertion stale route issue solved recently, and this policy visibility problem can be fixed in a similar way. The fix is to flush out the bundles of all policies deeper than the policy being inserted. Consider beginning state of "outgoing" direction policy list: policy A --> policy B --> policy C --> policy D First, realize that inserting a policy into a list only potentially changes IPSEC routes for that direction. Therefore we need not bother considering the policies for other directions. We need only consider the existing policies in the list we are doing the inserting. Consider new policy "B'", inserted after B. policy A --> policy B --> policy B' --> policy C --> policy D Two rules: 1) If policy A or policy B matched before the insertion, they appear before B' and thus would still match after inserting B' 2) Policy C and D, now "shadowed" and after policy B', potentially contain stale routes because policy B' might be selected instead of them. Therefore we only need flush routes assosciated with policies appearing after a newly inserted policy, if any. Signed-off-by: David S. Miller --- net/xfrm/xfrm_policy.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 54a4be6a7d2..d19e274b9c4 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -346,6 +346,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) struct xfrm_policy *pol, **p; struct xfrm_policy *delpol = NULL; struct xfrm_policy **newpos = NULL; + struct dst_entry *gc_list; write_lock_bh(&xfrm_policy_lock); for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) { @@ -381,9 +382,36 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) xfrm_pol_hold(policy); write_unlock_bh(&xfrm_policy_lock); - if (delpol) { + if (delpol) xfrm_policy_kill(delpol); + + read_lock_bh(&xfrm_policy_lock); + gc_list = NULL; + for (policy = policy->next; policy; policy = policy->next) { + struct dst_entry *dst; + + write_lock(&policy->lock); + dst = policy->bundles; + if (dst) { + struct dst_entry *tail = dst; + while (tail->next) + tail = tail->next; + tail->next = gc_list; + gc_list = dst; + + policy->bundles = NULL; + } + write_unlock(&policy->lock); } + read_unlock_bh(&xfrm_policy_lock); + + while (gc_list) { + struct dst_entry *dst = gc_list; + + gc_list = dst->next; + dst_free(dst); + } + return 0; } EXPORT_SYMBOL(xfrm_policy_insert); -- cgit v1.2.3 From d6f029130fb83b36fb709a187275b0494035d689 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 21 Dec 2005 12:26:25 -0500 Subject: [PATCH] fix race with preempt_enable() Currently a simple void foo(void) { preempt_enable(); } produces the following code on ARM: foo: bic r3, sp, #8128 bic r3, r3, #63 ldr r2, [r3, #4] ldr r1, [r3, #0] sub r2, r2, #1 tst r1, #4 str r2, [r3, #4] blne preempt_schedule mov pc, lr The problem is that the TIF_NEED_RESCHED flag is loaded _before_ the preemption count is stored back, hence any interrupt coming within that 3 instruction window causing TIF_NEED_RESCHED to be set won't be seen and scheduling won't happen as it should. Nothing currently prevents gcc from performing that reordering. There is already a barrier() before the decrement of the preemption count, but another one is needed between this and the TIF_NEED_RESCHED flag test for proper code ordering. Signed-off-by: Nicolas Pitre Acked-by: Nick Piggin Signed-off-by: Linus Torvalds --- include/linux/preempt.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/preempt.h b/include/linux/preempt.h index d9a2f5254a5..5769d14d1e6 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -48,6 +48,7 @@ do { \ #define preempt_enable() \ do { \ preempt_enable_no_resched(); \ + barrier(); \ preempt_check_resched(); \ } while (0) -- cgit v1.2.3 From 0800c5f7a499a8961c3868e95cc4cf1715166457 Mon Sep 17 00:00:00 2001 From: ASANO Masahiro Date: Thu, 22 Dec 2005 13:24:54 +0900 Subject: [PATCH] fix posix lock on NFS NFS client prevents mandatory lock, but there is a flaw on it; Locks are possibly left if the mode is changed while locking. This permits unlocking even if the mandatory lock bits are set. Signed-off-by: ASANO Masahiro Signed-off-by: Linus Torvalds --- fs/nfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index eb5cd4c3bbf..7a79fbe9f53 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -509,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) return -EINVAL; /* No mandatory locks over NFS */ - if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) + if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID && + fl->fl_type != F_UNLCK) return -ENOLCK; if (IS_GETLK(cmd)) -- cgit v1.2.3 From d2b18394259ef621fd2a6322aa9934198fd87a6a Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Dec 2005 23:21:38 +0000 Subject: [MMC] Set correct capacity for 1024-byte block cards We were passing set_capacity() the capacity we calculated in terms of the number of blocks on the card, which happened to be the right units for 512-byte block cards. However, with 1024-byte block cards, we end up setting the capacity to half the number of blocks. Fix this by shifting by the appropriate amount. Thanks to Todd Blumer for pointing this out. Use get_capacity() to report the card capacity, rather than recalculating it from the CSD information. Finally, use our chosen IO block size for the SET_BLOCKLEN command rather than the CSD read block size. Currently these are equivalent, but will not be in the future. Signed-off-by: Russell King --- drivers/mmc/mmc_block.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index d91fcf7c317..abcf19116d7 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c @@ -359,7 +359,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) md->block_bits = card->csd.read_blkbits; blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); - set_capacity(md->disk, card->csd.capacity); + + /* + * The CSD capacity field is in units of read_blkbits. + * set_capacity takes units of 512 bytes. + */ + set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9)); } out: return md; @@ -373,7 +378,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card) mmc_card_claim_host(card); cmd.opcode = MMC_SET_BLOCKLEN; - cmd.arg = 1 << card->csd.read_blkbits; + cmd.arg = 1 << md->block_bits; cmd.flags = MMC_RSP_R1; err = mmc_wait_for_cmd(card->host, &cmd, 5); mmc_card_release_host(card); @@ -412,10 +417,9 @@ static int mmc_blk_probe(struct mmc_card *card) if (err) goto out; - printk(KERN_INFO "%s: %s %s %dKiB %s\n", + printk(KERN_INFO "%s: %s %s %luKiB %s\n", md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), - (card->csd.capacity << card->csd.read_blkbits) / 1024, - mmc_blk_readonly(card)?"(ro)":""); + get_capacity(md->disk) >> 1, mmc_blk_readonly(card)?"(ro)":""); mmc_set_drvdata(card, md); add_disk(md->disk); -- cgit v1.2.3 From 75b245b3259133360845bc6de3aecb8a6bd6ab59 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 21 Dec 2005 01:29:00 -0500 Subject: [ACPI] fix passive cooling regression Return logic was inverted. Going for changing the return value to not return zero as it is makes more sense regarding the naming of the function (cpu_has_cpufreq()). http://bugzilla.kernel.org/show_bug.cgi?id=3410 Signed-off-by: Thomas Renninger Signed-off-by: Len Brown --- drivers/acpi/processor_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index f3758401532..dc9817cfb88 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -102,8 +102,8 @@ static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) - return -ENODEV; - return 0; + return 0; + return 1; } static int acpi_thermal_cpufreq_increase(unsigned int cpu) -- cgit v1.2.3 From 9d6be4bed65a3bd36ab2de12923bff4f4530bd86 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Thu, 22 Dec 2005 22:23:06 -0500 Subject: [ACPI] fix build warning from owner_id patch Signed-off-by: Len Brown --- drivers/acpi/utilities/utmisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index b886780f9de..2ce872d7589 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -87,7 +87,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) for (i = 0; i < 64; i++) { if (!(acpi_gbl_owner_id_mask & (1ULL << i))) { ACPI_DEBUG_PRINT((ACPI_DB_VALUES, - "Current owner_id mask: %16.16lX New ID: %2.2X\n", + "Current owner_id mask: %16.16LX New ID: %2.2X\n", acpi_gbl_owner_id_mask, (unsigned int)(i + 1))); -- cgit v1.2.3 From 14904398e5b573d13f8c8dbd43a452ff34c0efc2 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Wed, 21 Dec 2005 18:50:12 -0800 Subject: [SUNGEM]: Fix link error with CONFIG_HOTPLUG disabled. gem_remove_one() is called from the __devinit gem_init_one(). Therefore, gem_remove_one() mustn't be __devexit. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- drivers/net/sungem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 081717d0137..28ce47a0240 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -2907,7 +2907,7 @@ static int __devinit gem_get_device_address(struct gem *gp) return 0; } -static void __devexit gem_remove_one(struct pci_dev *pdev) +static void gem_remove_one(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); @@ -3181,7 +3181,7 @@ static struct pci_driver gem_driver = { .name = GEM_MODULE_NAME, .id_table = gem_pci_tbl, .probe = gem_init_one, - .remove = __devexit_p(gem_remove_one), + .remove = gem_remove_one, #ifdef CONFIG_PM .suspend = gem_suspend, .resume = gem_resume, -- cgit v1.2.3 From 0b57ee9e55373a27e45549e82b0c43621480a71b Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 22 Dec 2005 21:03:47 -0800 Subject: [SPARC]: introduce a SPARC Kconfig symbol Introduce a Kconfig symbol SPARC that is defined on both the sparc and sparc64 architectures. This symbol makes some dependencies more readable. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- arch/sparc/Kconfig | 4 ++++ arch/sparc64/Kconfig | 4 ++++ drivers/char/Kconfig | 4 ++-- drivers/char/keyboard.c | 10 +++++----- drivers/fc4/Kconfig | 8 ++++---- drivers/input/misc/Kconfig | 2 +- drivers/input/serio/i8042.h | 2 +- drivers/mtd/maps/Kconfig | 2 +- drivers/serial/Kconfig | 10 +++++----- drivers/video/Kconfig | 10 +++++----- drivers/video/console/Kconfig | 20 ++++++++++---------- drivers/video/logo/Kconfig | 2 +- fs/partitions/Kconfig | 2 +- sound/sparc/Kconfig | 2 +- 14 files changed, 45 insertions(+), 37 deletions(-) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 3cfb8be3ff6..56c34e7fd4e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -55,6 +55,10 @@ config NR_CPUS depends on SMP default "32" +config SPARC + bool + default y + # Identify this as a Sparc32 build config SPARC32 bool diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 3fded69b192..c4b7ad70cd7 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -5,6 +5,10 @@ mainmenu "Linux/UltraSPARC Kernel Configuration" +config SPARC + bool + default y + config SPARC64 bool default y diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 696f72787fe..84e68cdd451 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -687,7 +687,7 @@ config NVRAM config RTC tristate "Enhanced Real Time Clock Support" - depends on !PPC32 && !PARISC && !IA64 && !M68K && (!(SPARC32 || SPARC64) || PCI) + depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI) ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you @@ -735,7 +735,7 @@ config SGI_IP27_RTC config GEN_RTC tristate "Generic /dev/rtc emulation" - depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC32 && !SPARC64 + depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC ---help--- If you say Y here and create a character special file /dev/rtc with major number 10 and minor number 135 using mknod ("man mknod"), you diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 449d029ad4f..8b603b2d1c4 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -930,8 +930,8 @@ static void kbd_refresh_leds(struct input_handle *handle) } #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ - defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) ||\ - defined(CONFIG_SPARC64) || defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ + defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ + defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ @@ -958,7 +958,7 @@ static unsigned short x86_keycodes[256] = extern int mac_hid_mouse_emulate_buttons(int, int, int); #endif /* CONFIG_MAC_EMUMOUSEBTN */ -#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) +#ifdef CONFIG_SPARC static int sparc_l1_a_state = 0; extern void sun_do_break(void); #endif @@ -1045,7 +1045,7 @@ static void kbd_keycode(unsigned int keycode, int down, if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) sysrq_alt = down; -#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) +#ifdef CONFIG_SPARC if (keycode == KEY_STOP) sparc_l1_a_state = down; #endif @@ -1072,7 +1072,7 @@ static void kbd_keycode(unsigned int keycode, int down, return; } #endif -#if defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) +#ifdef CONFIG_SPARC if (keycode == KEY_A && sparc_l1_a_state) { sparc_l1_a_state = 0; sun_do_break(); diff --git a/drivers/fc4/Kconfig b/drivers/fc4/Kconfig index f00c02a13ed..345dbe6f10d 100644 --- a/drivers/fc4/Kconfig +++ b/drivers/fc4/Kconfig @@ -26,7 +26,7 @@ comment "FC4 drivers" config FC4_SOC tristate "Sun SOC/Sbus" - depends on FC4!=n && (SPARC32 || SPARC64) + depends on FC4!=n && SPARC help Serial Optical Channel is an interface card with one or two Fibre Optic ports, each of which can be connected to a disk array. Note @@ -38,7 +38,7 @@ config FC4_SOC config FC4_SOCAL tristate "Sun SOC+ (aka SOCAL)" - depends on FC4!=n && (SPARC32 || SPARC64) + depends on FC4!=n && SPARC ---help--- Serial Optical Channel Plus is an interface card with up to two Fibre Optic ports. This card supports FC Arbitrated Loop (usually @@ -62,7 +62,7 @@ config SCSI_PLUTO be called pluto. config SCSI_FCAL - tristate "Sun Enterprise Network Array (A5000 and EX500)" if SPARC32 || SPARC64 + tristate "Sun Enterprise Network Array (A5000 and EX500)" if SPARC depends on FC4!=n && SCSI help This driver drives FC-AL disks connected through a Fibre Channel @@ -75,7 +75,7 @@ config SCSI_FCAL config SCSI_FCAL prompt "Generic FC-AL disk driver" - depends on FC4!=n && SCSI && !SPARC32 && !SPARC64 + depends on FC4!=n && SCSI && !SPARC endmenu diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 07813fc0523..e08dbe08f46 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -26,7 +26,7 @@ config INPUT_PCSPKR config INPUT_SPARCSPKR tristate "SPARC Speaker support" - depends on PCI && (SPARC32 || SPARC64) + depends on PCI && SPARC help Say Y here if you want the standard Speaker on Sparc PCI systems to be used for bells and whistles. diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h index 13835039a2a..cbbf3842da5 100644 --- a/drivers/input/serio/i8042.h +++ b/drivers/input/serio/i8042.h @@ -21,7 +21,7 @@ #include "i8042-ip22io.h" #elif defined(CONFIG_PPC) #include "i8042-ppcio.h" -#elif defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) +#elif defined(CONFIG_SPARC) #include "i8042-sparcio.h" #elif defined(CONFIG_X86) || defined(CONFIG_IA64) #include "i8042-x86ia64io.h" diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 452ccd5037c..b9b77cf39a1 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -62,7 +62,7 @@ config MTD_PHYSMAP_BANKWIDTH config MTD_SUN_UFLASH tristate "Sun Microsystems userflash support" - depends on (SPARC32 || SPARC64) && MTD_CFI + depends on SPARC && MTD_CFI help This provides a 'mapping' driver which supports the way in which user-programmable flash chips are connected on various diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ad47c1b84c3..812bae62c8e 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -10,7 +10,7 @@ menu "Serial drivers" # The new 8250/16550 serial drivers config SERIAL_8250 tristate "8250/16550 and compatible serial support" - depends on (BROKEN || !(SPARC64 || SPARC32)) + depends on (BROKEN || !SPARC) select SERIAL_CORE ---help--- This selects whether you want to include the driver for the standard @@ -469,14 +469,14 @@ config SERIAL_IMX_CONSOLE config SERIAL_SUNCORE bool - depends on SPARC32 || SPARC64 + depends on SPARC select SERIAL_CORE select SERIAL_CORE_CONSOLE default y config SERIAL_SUNZILOG tristate "Sun Zilog8530 serial support" - depends on SPARC32 || SPARC64 + depends on SPARC help This driver supports the Zilog8530 serial ports found on many Sparc systems. Say Y or M if you want to be able to these serial ports. @@ -491,7 +491,7 @@ config SERIAL_SUNZILOG_CONSOLE config SERIAL_SUNSU tristate "Sun SU serial support" - depends on (SPARC32 || SPARC64) && PCI + depends on SPARC && PCI help This driver supports the 8250 serial ports that run the keyboard and mouse on (PCI) UltraSPARC systems. Say Y or M if you want to be able @@ -547,7 +547,7 @@ config PDC_CONSOLE config SERIAL_SUNSAB tristate "Sun Siemens SAB82532 serial support" - depends on (SPARC32 || SPARC64) && PCI + depends on SPARC && PCI help This driver supports the Siemens SAB82532 DUSCC serial ports on newer (PCI) UltraSPARC systems. Say Y or M if you want to be able to these diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3e470c8b419..cc8e3bf5001 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -536,13 +536,13 @@ config FB_SUN3 config FB_SBUS bool "SBUS and UPA framebuffers" - depends on (FB = y) && (SPARC32 || SPARC64) + depends on (FB = y) && SPARC help Say Y if you want support for SBUS or UPA based frame buffer device. config FB_BW2 bool "BWtwo support" - depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -551,7 +551,7 @@ config FB_BW2 config FB_CG3 bool "CGthree support" - depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT @@ -560,7 +560,7 @@ config FB_CG3 config FB_CG6 bool "CGsix (GX,TurboGX) support" - depends on (FB = y) && ((SPARC32 || SPARC64) && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) + depends on (FB = y) && (SPARC && FB_SBUS || (SUN3 || SUN3X) && FB_SUN3) select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT help @@ -1268,7 +1268,7 @@ config FB_LEO config FB_PCI bool "PCI framebuffers" - depends on (FB = y) && PCI && (SPARC64 || SPARC32) + depends on (FB = y) && PCI && SPARC config FB_IGA bool "IGA 168x display support" diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 5f74df99340..a5d09e159cd 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -6,7 +6,7 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EMBEDDED || !X86 - depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC32 && !SPARC64 && !M68K && !PARISC && !ARCH_VERSATILE + depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !ARCH_VERSATILE default y help Saying Y here will allow you to use Linux in text mode through a @@ -68,7 +68,7 @@ config SGI_NEWPORT_CONSOLE config PROM_CONSOLE bool "PROM console" - depends on SPARC32 || SPARC64 + depends on SPARC help Say Y to build a console driver for Sun machines that uses the terminal emulation built into their console PROMS. @@ -136,7 +136,7 @@ config FONTS config FONT_8x8 bool "VGA 8x8 font" if FONTS depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE - default y if !SPARC32 && !SPARC64 && !FONTS + default y if !SPARC && !FONTS help This is the "high resolution" font for the VGA frame buffer (the one provided by the text console 80x50 (and higher) modes). @@ -150,7 +150,7 @@ config FONT_8x8 config FONT_8x16 bool "VGA 8x16 font" if FONTS depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON - default y if !SPARC32 && !SPARC64 && !FONTS + default y if !SPARC && !FONTS help This is the "high resolution" font for the VGA frame buffer (the one provided by the VGA text console 80x25 mode. @@ -160,7 +160,7 @@ config FONT_8x16 config FONT_6x11 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE - default y if !SPARC32 && !SPARC64 && !FONTS && MAC + default y if !SPARC && !FONTS && MAC help Small console font with Macintosh-style high-half glyphs. Some Mac framebuffer drivers don't support this one at all. @@ -176,7 +176,7 @@ config FONT_7x14 config FONT_PEARL_8x8 bool "Pearl (old m68k) console 8x8 font" if FONTS depends on FRAMEBUFFER_CONSOLE - default y if !SPARC32 && !SPARC64 && !FONTS && AMIGA + default y if !SPARC && !FONTS && AMIGA help Small console font with PC-style control-character and high-half glyphs. @@ -184,24 +184,24 @@ config FONT_PEARL_8x8 config FONT_ACORN_8x8 bool "Acorn console 8x8 font" if FONTS depends on FRAMEBUFFER_CONSOLE - default y if !SPARC32 && !SPARC64 && !FONTS && ARM && ARCH_ACORN + default y if !SPARC && !FONTS && ARM && ARCH_ACORN help Small console font with PC-style control characters and high-half glyphs. config FONT_MINI_4x6 bool "Mini 4x6 font" - depends on !SPARC32 && !SPARC64 && FONTS + depends on !SPARC && FONTS config FONT_SUN8x16 bool "Sparc console 8x16 font" - depends on FRAMEBUFFER_CONSOLE && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64) + depends on FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC) help This is the high resolution console font for Sun machines. Say Y. config FONT_SUN12x22 bool "Sparc console 12x22 font (not supported by all drivers)" - depends on FRAMEBUFFER_CONSOLE && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64) + depends on FRAMEBUFFER_CONSOLE && (!SPARC && FONTS || SPARC) help This is the high resolution console font for Sun machines with very big letters (like the letters used in the SPARC PROM). If the diff --git a/drivers/video/logo/Kconfig b/drivers/video/logo/Kconfig index 8cb7fb4db44..f0e6512c87f 100644 --- a/drivers/video/logo/Kconfig +++ b/drivers/video/logo/Kconfig @@ -47,7 +47,7 @@ config LOGO_SGI_CLUT224 config LOGO_SUN_CLUT224 bool "224-color Sun Linux logo" - depends on LOGO && (SPARC32 || SPARC64) + depends on LOGO && SPARC default y config LOGO_SUPERH_MONO diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index deb25b661f0..656bc43431b 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig @@ -203,7 +203,7 @@ config ULTRIX_PARTITION config SUN_PARTITION bool "Sun partition tables support" if PARTITION_ADVANCED - default y if (SPARC32 || SPARC64 || SUN3 || SUN3X) + default y if (SPARC || SUN3 || SUN3X) ---help--- Like most systems, SunOS uses its own hard disk partition table format, incompatible with all others. Saying Y here allows you to diff --git a/sound/sparc/Kconfig b/sound/sparc/Kconfig index 09ab138646a..ef022a846b0 100644 --- a/sound/sparc/Kconfig +++ b/sound/sparc/Kconfig @@ -1,7 +1,7 @@ # ALSA Sparc drivers menu "ALSA Sparc devices" - depends on SND!=n && (SPARC32 || SPARC64) + depends on SND!=n && SPARC config SND_SUN_AMD7930 tristate "Sun AMD7930" -- cgit v1.2.3 From 597d1f0622d21ffe54aceef8da9682e776f51cc2 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 22 Dec 2005 23:04:39 -0800 Subject: [SPARC]: Kill CHILD_MAX. It's definition is wrong (-1 means "no limit" not 999), only the Sparc SunOS/Solaris compat code uses it, so let's just kill it off completely from limits.h and all referencing code. Noticed by Ulrich Drepper. Signed-off-by: David S. Miller --- arch/sparc/kernel/sys_sunos.c | 2 +- arch/sparc64/kernel/sys_sunos32.c | 2 +- arch/sparc64/solaris/misc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index 81c894acd0d..d07ae02101a 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -894,7 +894,7 @@ asmlinkage long sunos_sysconf (int name) ret = ARG_MAX; break; case _SC_CHILD_MAX: - ret = CHILD_MAX; + ret = -1; /* no limit */ break; case _SC_CLK_TCK: ret = HZ; diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index d0592ed54ea..bfa4aa68312 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -854,7 +854,7 @@ asmlinkage s32 sunos_sysconf (int name) ret = ARG_MAX; break; case _SC_CHILD_MAX: - ret = CHILD_MAX; + ret = -1; /* no limit */ break; case _SC_CLK_TCK: ret = HZ; diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index 302efbcba70..3ab4677395f 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -353,7 +353,7 @@ asmlinkage int solaris_sysconf(int id) { switch (id) { case SOLARIS_CONFIG_NGROUPS: return NGROUPS_MAX; - case SOLARIS_CONFIG_CHILD_MAX: return CHILD_MAX; + case SOLARIS_CONFIG_CHILD_MAX: return -1; /* no limit */ case SOLARIS_CONFIG_OPEN_FILES: return OPEN_MAX; case SOLARIS_CONFIG_POSIX_VER: return 199309; case SOLARIS_CONFIG_PAGESIZE: return PAGE_SIZE; -- cgit v1.2.3 From 3dd3bf83574e38578fc9741c0e23e4fa7f7ff96e Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Fri, 23 Dec 2005 11:23:21 -0800 Subject: [IPV6]: Fix dead lock. We need to relesae ifp->lock before we call addrconf_dad_stop(), which will hold ifp->lock. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 510220f2ae8..d805241e439 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2467,9 +2467,11 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) return; } - if (idev->if_flags & IF_READY) + if (idev->if_flags & IF_READY) { addrconf_dad_kick(ifp); - else { + spin_unlock_bh(&ifp->lock); + } else { + spin_unlock_bh(&ifp->lock); /* * If the defice is not ready: * - keep it tentative if it is a permanent address. @@ -2478,8 +2480,6 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) in6_ifa_hold(ifp); addrconf_dad_stop(ifp); } - - spin_unlock_bh(&ifp->lock); out: read_unlock_bh(&idev->lock); } -- cgit v1.2.3 From 291d809ba5c8d4d6d8812e3f185bdf57d539f594 Mon Sep 17 00:00:00 2001 From: Hiroyuki YAMAMORI Date: Fri, 23 Dec 2005 11:24:05 -0800 Subject: [IPV6]: Fix Temporary Address Generation From: Hiroyuki YAMAMORI Since regen_count is stored in the public address, we need to reset it when we start renewing temporary address. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d805241e439..2a6439e3c91 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2782,6 +2782,9 @@ restart: in6_ifa_hold(ifpub); spin_unlock(&ifp->lock); read_unlock(&addrconf_hash_lock); + spin_lock(&ifpub->lock); + ifpub->regen_count = 0; + spin_unlock(&ifpub->lock); ipv6_create_tempaddr(ifpub, ifp); in6_ifa_put(ifpub); in6_ifa_put(ifp); -- cgit v1.2.3 From fd71da468dd8897fe3f565dfd3743a87d8678e3a Mon Sep 17 00:00:00 2001 From: Tony Battersby Date: Wed, 21 Dec 2005 16:35:44 -0500 Subject: [PATCH] fix libata inquiry VPD for ATAPI devices The following patch prevents libata from incorrectly modifying inquiry VPD pages and command support data from ATAPI devices. I have tested the patch with a SATA ATAPI tape drive on an AHCI controller. Patch is against kernel 2.4.32 with 2.4.32-libata1.patch applied. Anthony J. Battersby Cybernetics Signed-off-by: Jeff Garzik --- drivers/scsi/libata-scsi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 72ddba98f8f..2282c04fee4 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -2044,7 +2044,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) else { u8 *scsicmd = cmd->cmnd; - if (scsicmd[0] == INQUIRY) { + if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { u8 *buf = NULL; unsigned int buflen; @@ -2057,9 +2057,6 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) * to indicate to the Linux scsi midlayer this is a modern * device. 2) Ensure response data format / ATAPI information * are always correct. - */ - /* FIXME: do we ever override EVPD pages and the like, with - * this code? */ if (buf[2] == 0) { buf[2] = 0x5; -- cgit v1.2.3 From c8cb00f6ac9aa13b0575726163b165fd2276ff25 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 16 Dec 2005 18:49:53 -0500 Subject: [PATCH] orinoco_nortel: Fix incorrect PCI resource use orinoco_nortel was broken during conversion to iomem API. Wrong PCI BAR is used for chipset registers. Reported by Tomas Novak Signed-off-by: Pavel Roskin Signed-off-by: Jeff Garzik --- drivers/net/wireless/orinoco_nortel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index d8afd51ff8a..e39c08b8870 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c @@ -165,7 +165,7 @@ static int nortel_pci_init_one(struct pci_dev *pdev, goto fail_resources; } - iomem = pci_iomap(pdev, 3, 0); + iomem = pci_iomap(pdev, 2, 0); if (!iomem) { err = -ENOMEM; goto fail_map_io; -- cgit v1.2.3 From d495657200bd3ce10f9cb52401056804bf365811 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 16 Dec 2005 18:57:10 -0500 Subject: [PATCH] orinoco_nortel: Add Symbol LA-4123 ID Add ID for Symbol LA-4123. Reported by Tomas Novak Signed-off-by: Pavel Roskin Signed-off-by: Jeff Garzik --- drivers/net/wireless/orinoco_nortel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index e39c08b8870..d1a670b3533 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c @@ -1,6 +1,8 @@ /* orinoco_nortel.c * * Driver for Prism II devices which would usually be driven by orinoco_cs, + * but are connected to the PCI bus by a PCI-to-PCMCIA adapter used in + * Nortel emobility, Symbol LA-4113 and Symbol LA-4123. * but are connected to the PCI bus by a Nortel PCI-PCMCIA-Adapter. * * Copyright (C) 2002 Tobias Hoffmann @@ -265,6 +267,8 @@ static void __devexit nortel_pci_remove_one(struct pci_dev *pdev) static struct pci_device_id nortel_pci_id_table[] = { /* Nortel emobility PCI */ {0x126c, 0x8030, PCI_ANY_ID, PCI_ANY_ID,}, + /* Symbol LA-4123 PCI */ + {0x1562, 0x0001, PCI_ANY_ID, PCI_ANY_ID,}, {0,}, }; -- cgit v1.2.3 From afcceaa3c7b7fbf7e2b95c5f0dd43547b03292d2 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 14 Dec 2005 00:33:49 +0100 Subject: [PATCH] missing license for libphy.ko Andy, libphy has no license tag. Something like the attached (untested!) patch is needed. Hopefully such a change finds its way into 2.6.15. filename: /lib/modules/2.6.15-rc5-3-ppc64/kernel/drivers/net/phy/libphy.ko vermagic: 2.6.15-rc5-3-ppc64 SMP gcc-4.1 depends: srcversion: ACC921B5E82701BE1E6F603 drivers/net/phy/phy_device.c | 4 ++++ 1 files changed, 4 insertions(+) Signed-off-by: Jeff Garzik --- drivers/net/phy/phy_device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 16bebe7a7ce..7da0e3dd5fe 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -38,6 +38,10 @@ #include #include +MODULE_DESCRIPTION("PHY library"); +MODULE_AUTHOR("Andy Fleming"); +MODULE_LICENSE("GPL"); + static struct phy_driver genphy_driver; extern int mdio_bus_init(void); extern void mdio_bus_exit(void); -- cgit v1.2.3 From 6c6b3e7c4f93d330b920e6531b579b1f6bae5ac1 Mon Sep 17 00:00:00 2001 From: Frank Pavlic Date: Tue, 13 Dec 2005 08:21:47 +0100 Subject: [PATCH] s390: some minor qeth driver fixes [patch 1/3] s390: some minor qeth driver fixes From: Frank Pavlic - let's have just one function for both ,input and output queue to check qdio errors - add /proc/s390dbf/qeth_qerr entries for outbound processing - check removed for layer2 device in qeth_add_multicast_ipv6 - NULL pointer dereference with bonding and VLAN device fixed - minimum length check for portname fixed Signed-off-by: Frank Pavlic diffstat: qeth_main.c | 42 +++++++++++++++++++++--------------------- qeth_sys.c | 6 +++--- 2 files changed, 24 insertions(+), 24 deletions(-) Signed-off-by: Jeff Garzik --- drivers/s390/net/qeth_main.c | 42 +++++++++++++++++++++--------------------- drivers/s390/net/qeth_sys.c | 6 +++--- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 99cceb242ec..5d2d548e542 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.242 $) + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.246 $) * * Linux on zSeries OSA Express and HiperSockets support * @@ -72,7 +72,7 @@ #include "qeth_eddp.h" #include "qeth_tso.h" -#define VERSION_QETH_C "$Revision: 1.242 $" +#define VERSION_QETH_C "$Revision: 1.246 $" static const char *version = "qeth S/390 OSA-Express driver"; /** @@ -2203,24 +2203,21 @@ qeth_ulp_setup(struct qeth_card *card) } static inline int -qeth_check_for_inbound_error(struct qeth_qdio_buffer *buf, - unsigned int qdio_error, - unsigned int siga_error) +qeth_check_qdio_errors(struct qdio_buffer *buf, unsigned int qdio_error, + unsigned int siga_error, const char *dbftext) { - int rc = 0; - if (qdio_error || siga_error) { - QETH_DBF_TEXT(trace, 2, "qdinerr"); - QETH_DBF_TEXT(qerr, 2, "qdinerr"); + QETH_DBF_TEXT(trace, 2, dbftext); + QETH_DBF_TEXT(qerr, 2, dbftext); QETH_DBF_TEXT_(qerr, 2, " F15=%02X", - buf->buffer->element[15].flags & 0xff); + buf->element[15].flags & 0xff); QETH_DBF_TEXT_(qerr, 2, " F14=%02X", - buf->buffer->element[14].flags & 0xff); + buf->element[14].flags & 0xff); QETH_DBF_TEXT_(qerr, 2, " qerr=%X", qdio_error); QETH_DBF_TEXT_(qerr, 2, " serr=%X", siga_error); - rc = 1; + return 1; } - return rc; + return 0; } static inline struct sk_buff * @@ -2769,8 +2766,9 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status, for (i = first_element; i < (first_element + count); ++i) { index = i % QDIO_MAX_BUFFERS_PER_Q; buffer = &card->qdio.in_q->bufs[index]; - if (!((status == QDIO_STATUS_LOOK_FOR_ERROR) && - qeth_check_for_inbound_error(buffer, qdio_err, siga_err))) + if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) && + qeth_check_qdio_errors(buffer->buffer, + qdio_err, siga_err,"qinerr"))) qeth_process_inbound_buffer(card, buffer, index); /* clear buffer and give back to hardware */ qeth_put_buffer_pool_entry(card, buffer->pool_entry); @@ -2785,12 +2783,13 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status, static inline int qeth_handle_send_error(struct qeth_card *card, struct qeth_qdio_out_buffer *buffer, - int qdio_err, int siga_err) + unsigned int qdio_err, unsigned int siga_err) { int sbalf15 = buffer->buffer->element[15].flags & 0xff; int cc = siga_err & 3; QETH_DBF_TEXT(trace, 6, "hdsnderr"); + qeth_check_qdio_errors(buffer->buffer, qdio_err, siga_err, "qouterr"); switch (cc) { case 0: if (qdio_err){ @@ -3047,7 +3046,8 @@ qeth_qdio_output_handler(struct ccw_device * ccwdev, unsigned int status, for(i = first_element; i < (first_element + count); ++i){ buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; /*we only handle the KICK_IT error by doing a recovery */ - if (qeth_handle_send_error(card, buffer, qdio_error, siga_error) + if (qeth_handle_send_error(card, buffer, + qdio_error, siga_error) == QETH_SEND_ERROR_KICK_IT){ netif_stop_queue(card->dev); qeth_schedule_recovery(card); @@ -3289,7 +3289,6 @@ qeth_init_qdio_info(struct qeth_card *card) card->qdio.in_buf_pool.buf_count = card->qdio.init_pool.buf_count; INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); - /* outbound */ } static int @@ -3731,6 +3730,9 @@ qeth_verify_vlan_dev(struct net_device *dev, struct qeth_card *card) break; } } + if (rc && !(VLAN_DEV_INFO(dev)->real_dev->priv == (void *)card)) + return 0; + #endif return rc; } @@ -5870,10 +5872,8 @@ qeth_add_multicast_ipv6(struct qeth_card *card) struct inet6_dev *in6_dev; QETH_DBF_TEXT(trace,4,"chkmcv6"); - if ((card->options.layer2 == 0) && - (!qeth_is_supported(card, IPA_IPV6)) ) + if (!qeth_is_supported(card, IPA_IPV6)) return ; - in6_dev = in6_dev_get(card->dev); if (in6_dev == NULL) return; diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index ddd6019ba09..80925964eb7 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.58 $) + * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.59 $) * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to sysfs. @@ -20,7 +20,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_SYS_C = "$Revision: 1.58 $"; +const char *VERSION_QETH_SYS_C = "$Revision: 1.59 $"; /*****************************************************************************/ /* */ @@ -160,7 +160,7 @@ qeth_dev_portname_store(struct device *dev, struct device_attribute *attr, const return -EPERM; tmp = strsep((char **) &buf, "\n"); - if ((strlen(tmp) > 8) || (strlen(tmp) < 2)) + if ((strlen(tmp) > 8) || (strlen(tmp) == 0)) return -EINVAL; card->info.portname[0] = strlen(tmp); -- cgit v1.2.3 From 4965e97fd36041d19483843c66286b9800a57c15 Mon Sep 17 00:00:00 2001 From: Frank Pavlic Date: Tue, 13 Dec 2005 08:22:30 +0100 Subject: [PATCH] s390: minor qeth network driver fixes [patch 2/3] s390: minor qeth network driver fixes From: Frank Pavlic - use netif_carrier_on/off calls to tell network stack link carrier state - fix possible kfree on NULL - PDU_LEN2 is at offset 0x29 otherwise OSN chpid won't initialize Signed-off-by: Frank Pavlic diffstat: qeth_eddp.c | 3 ++- qeth_main.c | 17 +++++++---------- qeth_mpc.h | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) Signed-off-by: Jeff Garzik --- drivers/s390/net/qeth_eddp.c | 3 ++- drivers/s390/net/qeth_main.c | 17 +++++++---------- drivers/s390/net/qeth_mpc.h | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 011915d5e24..f94f1f25eec 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c @@ -62,7 +62,8 @@ qeth_eddp_free_context(struct qeth_eddp_context *ctx) for (i = 0; i < ctx->num_pages; ++i) free_page((unsigned long)ctx->pages[i]); kfree(ctx->pages); - kfree(ctx->elements); + if (ctx->elements != NULL) + kfree(ctx->elements); kfree(ctx); } diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 5d2d548e542..e693dc4ce86 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -518,7 +518,8 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode) QETH_DBF_TEXT(setup, 3, "setoffl"); QETH_DBF_HEX(setup, 3, &card, sizeof(void *)); - + + netif_carrier_off(card->dev); recover_flag = card->state; if (qeth_stop_card(card, recovery_mode) == -ERESTARTSYS){ PRINT_WARN("Stopping card %s interrupted by user!\n", @@ -1020,7 +1021,6 @@ void qeth_schedule_recovery(struct qeth_card *card) { QETH_DBF_TEXT(trace,2,"startrec"); - if (qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD) == 0) schedule_work(&card->kernel_thread_starter); } @@ -1710,7 +1710,6 @@ qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob) "IP address reset.\n", QETH_CARD_IFNAME(card), card->info.chpid); - netif_carrier_on(card->dev); qeth_schedule_recovery(card); return NULL; case IPA_CMD_MODCCID: @@ -1959,7 +1958,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, { u16 s1, s2; -QETH_DBF_TEXT(trace,4,"osndipa"); + QETH_DBF_TEXT(trace,4,"osndipa"); qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); s1 = (u16)(IPA_PDU_HEADER_SIZE + data_len); @@ -3809,10 +3808,8 @@ qeth_open(struct net_device *dev) card->data.state = CH_STATE_UP; card->state = CARD_STATE_UP; - if (!card->lan_online){ - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); - } + if (!card->lan_online && netif_carrier_ok(dev)) + netif_carrier_off(dev); return 0; } @@ -7936,8 +7933,8 @@ __qeth_set_online(struct ccwgroup_device *gdev, int recovery_mode) QETH_DBF_TEXT_(setup, 2, "6err%d", rc); goto out_remove; } -/*maybe it was set offline without ifconfig down - * we can also use this state for recovery purposes*/ + netif_carrier_on(card->dev); + qeth_set_allowed_threads(card, 0xffffffff, 0); if (recover_flag == CARD_STATE_RECOVER) qeth_start_again(card, recovery_mode); diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 5f71486e708..00c71786e89 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h @@ -21,7 +21,7 @@ extern const char *VERSION_QETH_MPC_C; #define IPA_PDU_HEADER_SIZE 0x40 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e) #define QETH_IPA_PDU_LEN_PDU1(buffer) (buffer+0x26) -#define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x2a) +#define QETH_IPA_PDU_LEN_PDU2(buffer) (buffer+0x29) #define QETH_IPA_PDU_LEN_PDU3(buffer) (buffer+0x3a) extern unsigned char IPA_PDU_HEADER[]; -- cgit v1.2.3 From 3df3cc6d18b6dcd38c33c198fb8adf1f1fa5f4a7 Mon Sep 17 00:00:00 2001 From: Frank Pavlic Date: Tue, 13 Dec 2005 08:23:26 +0100 Subject: [PATCH] s390: remove redundant and useless code in qeth [patch 3/3] s390: remove redundant and useless code in qeth From: Frank Pavlic - remove redundant and useless code in qeth for procfs operations. - update Revision numbers Signed-off-by: Frank Pavlic diffstat: qeth_main.c | 6 - qeth_mpc.c | 2 qeth_mpc.h | 2 qeth_proc.c | 250 ++++++------------------------------------------------------ qeth_sys.c | 4 qeth_tso.h | 4 6 files changed, 38 insertions(+), 230 deletions(-) Signed-off-by: Jeff Garzik --- drivers/s390/net/qeth_main.c | 6 +- drivers/s390/net/qeth_mpc.c | 2 +- drivers/s390/net/qeth_mpc.h | 2 +- drivers/s390/net/qeth_proc.c | 250 +++++-------------------------------------- drivers/s390/net/qeth_sys.c | 4 +- drivers/s390/net/qeth_tso.h | 4 +- 6 files changed, 38 insertions(+), 230 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index e693dc4ce86..f8f55cc468b 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_main.c ($Revision: 1.246 $) + * linux/drivers/s390/net/qeth_main.c ($Revision: 1.251 $) * * Linux on zSeries OSA Express and HiperSockets support * @@ -12,7 +12,7 @@ * Frank Pavlic (fpavlic@de.ibm.com) and * Thomas Spatzier * - * $Revision: 1.242 $ $Date: 2005/05/04 20:19:18 $ + * $Revision: 1.251 $ $Date: 2005/05/04 20:19:18 $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ #include "qeth_eddp.h" #include "qeth_tso.h" -#define VERSION_QETH_C "$Revision: 1.246 $" +#define VERSION_QETH_C "$Revision: 1.251 $" static const char *version = "qeth S/390 OSA-Express driver"; /** diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c index f0a080a9e51..5f8754addc1 100644 --- a/drivers/s390/net/qeth_mpc.c +++ b/drivers/s390/net/qeth_mpc.c @@ -11,7 +11,7 @@ #include #include "qeth_mpc.h" -const char *VERSION_QETH_MPC_C = "$Revision: 1.12 $"; +const char *VERSION_QETH_MPC_C = "$Revision: 1.13 $"; unsigned char IDX_ACTIVATE_READ[]={ 0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00, diff --git a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h index 00c71786e89..864cec5f6c6 100644 --- a/drivers/s390/net/qeth_mpc.h +++ b/drivers/s390/net/qeth_mpc.h @@ -14,7 +14,7 @@ #include -#define VERSION_QETH_MPC_H "$Revision: 1.44 $" +#define VERSION_QETH_MPC_H "$Revision: 1.46 $" extern const char *VERSION_QETH_MPC_C; diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index f2ccfea8fdb..7bf35098831 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.13 $) + * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.16 $) * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to procfs. @@ -21,7 +21,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; +const char *VERSION_QETH_PROC_C = "$Revision: 1.16 $"; /***** /proc/qeth *****/ #define QETH_PROCFILE_NAME "qeth" @@ -30,30 +30,26 @@ static struct proc_dir_entry *qeth_procfile; static int qeth_procfile_seq_match(struct device *dev, void *data) { - return 1; + return(dev ? 1 : 0); } static void * qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) { - struct device *dev; - loff_t nr; - + struct device *dev = NULL; + loff_t nr = 0; + down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - nr = *offset; - if (nr == 0) + if (*offset == 0) return SEQ_START_TOKEN; - - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, - NULL, qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) + while (1) { dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, NULL, qeth_procfile_seq_match); - return (void *) dev; + if (++nr == *offset) + break; + put_device(dev); + } + return dev; } static void @@ -66,19 +62,14 @@ static void * qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) { struct device *prev, *next; - - if (it == SEQ_START_TOKEN) { - next = driver_find_device(&qeth_ccwgroup_driver.driver, - NULL, NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; - } - prev = (struct device *) it; + + if (it == SEQ_START_TOKEN) + prev = NULL; + else + prev = (struct device *) it; next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; + (*offset)++; return (void *) next; } @@ -87,7 +78,7 @@ qeth_get_router_str(struct qeth_card *card, int ipv) { int routing_type = 0; - if (ipv == 4){ + if (ipv == 4) { routing_type = card->options.route4.type; } else { #ifdef CONFIG_QETH_IPV6 @@ -154,6 +145,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it) card->qdio.in_buf_pool.buf_count); else seq_printf(s, " +++ LAN OFFLINE +++\n"); + put_device(device); } return 0; } @@ -184,51 +176,16 @@ static struct file_operations qeth_procfile_fops = { static struct proc_dir_entry *qeth_perf_procfile; #ifdef CONFIG_QETH_PERF_STATS - -static void * -qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) -{ - struct device *dev = NULL; - int nr; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - /* get card at pos *offset */ - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, - qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, - NULL, qeth_procfile_seq_match); - return (void *) dev; -} - -static void -qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) -{ - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static void * -qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) -{ - struct device *prev, *next; - - prev = (struct device *) it; - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, - NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; -} - static int qeth_perf_procfile_seq_show(struct seq_file *s, void *it) { struct device *device; struct qeth_card *card; + + if (it == SEQ_START_TOKEN) + return 0; + device = (struct device *) it; card = device->driver_data; seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", @@ -295,13 +252,14 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) card->perf_stats.outbound_do_qdio_time, card->perf_stats.outbound_do_qdio_cnt ); + put_device(device); return 0; } static struct seq_operations qeth_perf_procfile_seq_ops = { - .start = qeth_perf_procfile_seq_start, - .stop = qeth_perf_procfile_seq_stop, - .next = qeth_perf_procfile_seq_next, + .start = qeth_procfile_seq_start, + .stop = qeth_procfile_seq_stop, + .next = qeth_procfile_seq_next, .show = qeth_perf_procfile_seq_show, }; @@ -324,93 +282,6 @@ static struct file_operations qeth_perf_procfile_fops = { #define qeth_perf_procfile_created 1 #endif /* CONFIG_QETH_PERF_STATS */ -/***** /proc/qeth_ipa_takeover *****/ -#define QETH_IPATO_PROCFILE_NAME "qeth_ipa_takeover" -static struct proc_dir_entry *qeth_ipato_procfile; - -static void * -qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) -{ - struct device *dev; - loff_t nr; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - /* TODO: finish this */ - /* - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 - * output driver settings then; - * else output setting for respective card - */ - - dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, - qeth_procfile_seq_match); - - /* get card at pos *offset */ - nr = *offset; - while (nr-- > 1 && dev) - dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, - NULL, qeth_procfile_seq_match); - return (void *) dev; -} - -static void -qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) -{ - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static void * -qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) -{ - struct device *prev, *next; - - prev = (struct device *) it; - next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, - NULL, qeth_procfile_seq_match); - if (next) - (*offset)++; - return (void *) next; -} - -static int -qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) -{ - struct device *device; - struct qeth_card *card; - - /* TODO: finish this */ - /* - * maybe SEQ_SATRT_TOKEN can be returned for offset 0 - * output driver settings then; - * else output setting for respective card - */ - device = (struct device *) it; - card = device->driver_data; - - return 0; -} - -static struct seq_operations qeth_ipato_procfile_seq_ops = { - .start = qeth_ipato_procfile_seq_start, - .stop = qeth_ipato_procfile_seq_stop, - .next = qeth_ipato_procfile_seq_next, - .show = qeth_ipato_procfile_seq_show, -}; - -static int -qeth_ipato_procfile_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &qeth_ipato_procfile_seq_ops); -} - -static struct file_operations qeth_ipato_procfile_fops = { - .owner = THIS_MODULE, - .open = qeth_ipato_procfile_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - int __init qeth_create_procfs_entries(void) { @@ -426,13 +297,7 @@ qeth_create_procfs_entries(void) qeth_perf_procfile->proc_fops = &qeth_perf_procfile_fops; #endif /* CONFIG_QETH_PERF_STATS */ - qeth_ipato_procfile = create_proc_entry(QETH_IPATO_PROCFILE_NAME, - S_IFREG | 0444, NULL); - if (qeth_ipato_procfile) - qeth_ipato_procfile->proc_fops = &qeth_ipato_procfile_fops; - if (qeth_procfile && - qeth_ipato_procfile && qeth_perf_procfile_created) return 0; else @@ -446,62 +311,5 @@ qeth_remove_procfs_entries(void) remove_proc_entry(QETH_PROCFILE_NAME, NULL); if (qeth_perf_procfile) remove_proc_entry(QETH_PERF_PROCFILE_NAME, NULL); - if (qeth_ipato_procfile) - remove_proc_entry(QETH_IPATO_PROCFILE_NAME, NULL); } - -/* ONLY FOR DEVELOPMENT! -> make it as module */ -/* -static void -qeth_create_sysfs_entries(void) -{ - struct device *dev; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, - driver_list) - qeth_create_device_attributes(dev); - - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static void -qeth_remove_sysfs_entries(void) -{ - struct device *dev; - - down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); - - list_for_each_entry(dev, &qeth_ccwgroup_driver.driver.devices, - driver_list) - qeth_remove_device_attributes(dev); - - up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); -} - -static int __init -qeth_fs_init(void) -{ - printk(KERN_INFO "qeth_fs_init\n"); - qeth_create_procfs_entries(); - qeth_create_sysfs_entries(); - - return 0; -} - -static void __exit -qeth_fs_exit(void) -{ - printk(KERN_INFO "qeth_fs_exit\n"); - qeth_remove_procfs_entries(); - qeth_remove_sysfs_entries(); -} - - -module_init(qeth_fs_init); -module_exit(qeth_fs_exit); - -MODULE_LICENSE("GPL"); -*/ diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 80925964eb7..0ea185f70f7 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c @@ -1,6 +1,6 @@ /* * - * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.59 $) + * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.60 $) * * Linux on zSeries OSA Express and HiperSockets support * This file contains code related to sysfs. @@ -20,7 +20,7 @@ #include "qeth_mpc.h" #include "qeth_fs.h" -const char *VERSION_QETH_SYS_C = "$Revision: 1.59 $"; +const char *VERSION_QETH_SYS_C = "$Revision: 1.60 $"; /*****************************************************************************/ /* */ diff --git a/drivers/s390/net/qeth_tso.h b/drivers/s390/net/qeth_tso.h index e245af3c4cb..3c50b6f24f5 100644 --- a/drivers/s390/net/qeth_tso.h +++ b/drivers/s390/net/qeth_tso.h @@ -1,5 +1,5 @@ /* - * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.7 $) + * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.8 $) * * Header file for qeth TCP Segmentation Offload support. * @@ -7,7 +7,7 @@ * * Author(s): Frank Pavlic * - * $Revision: 1.7 $ $Date: 2005/05/04 20:19:18 $ + * $Revision: 1.8 $ $Date: 2005/05/04 20:19:18 $ * */ #ifndef __QETH_TSO_H__ -- cgit v1.2.3 From 1836098f97d22c81652aeeec64d1819dc2177bdb Mon Sep 17 00:00:00 2001 From: Manfred Spraul Date: Sat, 24 Dec 2005 14:19:24 +0100 Subject: [PATCH] forcedeth: fix random memory scribbling bug Two critical bugs were found in forcedeth 0.47: - TSO doesn't work. - pci_map_single() for the rx buffers is called with size==0. This bug is critical, it causes random memory corruptions on systems with an iommu. Below is a minimal fix for both bugs, for 2.6.15. TSO will be fixed properly in the next version. Tested on x86-64. Signed-Off-By: Manfred Spraul Signed-off-by: Linus Torvalds --- drivers/net/forcedeth.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 525624fc03b..c39344adecc 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c @@ -10,7 +10,7 @@ * trademarks of NVIDIA Corporation in the United States and other * countries. * - * Copyright (C) 2003,4 Manfred Spraul + * Copyright (C) 2003,4,5 Manfred Spraul * Copyright (C) 2004 Andrew de Quincey (wol support) * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane * IRQ rate fixes, bigendian fixes, cleanups, verification) @@ -100,6 +100,7 @@ * 0.45: 18 Sep 2005: Remove nv_stop/start_rx from every link check * 0.46: 20 Oct 2005: Add irq optimization modes. * 0.47: 26 Oct 2005: Add phyaddr 0 in phy scan. + * 0.48: 24 Dec 2005: Disable TSO, bugfix for pci_map_single * * Known bugs: * We suspect that on some hardware no TX done interrupts are generated. @@ -111,7 +112,7 @@ * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few * superfluous timer interrupts from the nic. */ -#define FORCEDETH_VERSION "0.47" +#define FORCEDETH_VERSION "0.48" #define DRV_NAME "forcedeth" #include @@ -871,8 +872,8 @@ static int nv_alloc_rx(struct net_device *dev) } else { skb = np->rx_skbuff[nr]; } - np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, skb->len, - PCI_DMA_FROMDEVICE); + np->rx_dma[nr] = pci_map_single(np->pci_dev, skb->data, + skb->end-skb->data, PCI_DMA_FROMDEVICE); if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { np->rx_ring.orig[nr].PacketBuffer = cpu_to_le32(np->rx_dma[nr]); wmb(); @@ -999,7 +1000,7 @@ static void nv_drain_rx(struct net_device *dev) wmb(); if (np->rx_skbuff[i]) { pci_unmap_single(np->pci_dev, np->rx_dma[i], - np->rx_skbuff[i]->len, + np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, PCI_DMA_FROMDEVICE); dev_kfree_skb(np->rx_skbuff[i]); np->rx_skbuff[i] = NULL; @@ -1334,7 +1335,7 @@ static void nv_rx_process(struct net_device *dev) * the performance. */ pci_unmap_single(np->pci_dev, np->rx_dma[i], - np->rx_skbuff[i]->len, + np->rx_skbuff[i]->end-np->rx_skbuff[i]->data, PCI_DMA_FROMDEVICE); { @@ -2455,7 +2456,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; #ifdef NETIF_F_TSO - dev->features |= NETIF_F_TSO; + /* disabled dev->features |= NETIF_F_TSO; */ #endif } -- cgit v1.2.3 From e445ee65cbefaa19131c972ae7fe221c95cf4cc4 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Sat, 24 Dec 2005 12:06:10 -0800 Subject: [VIDEO] sbuslib: Disallow private mmaps. The COW semantics just do not make any sense especially with the physically discontiguous I/O mappings possible here. Signed-off-by: David S. Miller --- drivers/video/sbuslib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index 646c43f921c..3a74a63dd4f 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c @@ -46,6 +46,9 @@ int sbusfb_mmap_helper(struct sbus_mmap_map *map, unsigned long off; int i; + if (!(vma->vm_flags & (VM_SHARED | VM_MAYSHARE))) + return -EINVAL; + size = vma->vm_end - vma->vm_start; if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) return -EINVAL; -- cgit v1.2.3 From 6003a93e7bf6c02f33c02976ff364785d4273295 Mon Sep 17 00:00:00 2001 From: Manfred Spraul Date: Fri, 23 Dec 2005 23:57:41 +0100 Subject: [PATCH] add missing memory barriers to ipc/sem.c Two smp_wmb() statements are missing in the sysv sem code: This could cause stack corruptions. The attached patch adds them. Signed-Off-By: Manfred Spraul Signed-off-by: Linus Torvalds --- ipc/sem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ipc/sem.c b/ipc/sem.c index 19af028a3e3..6a16f8edf2b 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -381,6 +381,7 @@ static void update_queue (struct sem_array * sma) /* hands-off: q will disappear immediately after * writing q->status. */ + smb_wmb(); q->status = error; q = n; } else { @@ -461,6 +462,7 @@ static void freeary (struct sem_array *sma, int id) n = q->next; q->status = IN_WAKEUP; wake_up_process(q->sleeper); /* doesn't sleep */ + smp_wmb(); q->status = -EIDRM; /* hands-off q */ q = n; } -- cgit v1.2.3 From 8e31108b9f41069d55cb9b019ac8262c55fd2616 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 23 Dec 2005 19:54:46 -0800 Subject: [PATCH] Fix memory ordering problem in wake_futex() Fix a memory ordering problem that occurs on IA64. The "store" to q->lock_ptr in wake_futex() can become visible before wake_up_all() clears the lock in the futex_q. Signed-off-by: Jack Steiner Acked-by: Ingo Molnar Signed-off-by: Linus Torvalds --- kernel/futex.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index 5872e3507f3..5e71a6bf6f6 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -270,7 +270,13 @@ static void wake_futex(struct futex_q *q) /* * The waiting task can free the futex_q as soon as this is written, * without taking any locks. This must come last. + * + * A memory barrier is required here to prevent the following store + * to lock_ptr from getting ahead of the wakeup. Clearing the lock + * at the end of wake_up_all() does not prevent this store from + * moving. */ + wmb(); q->lock_ptr = NULL; } -- cgit v1.2.3 From 1224b375ed7982128602a3fa1da53eeeac1750b4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 24 Dec 2005 12:19:38 -0800 Subject: Fix silly typo ("smb" vs "smp") Introduced by commit 6003a93e7bf6c02f33c02976ff364785d4273295 --- ipc/sem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/sem.c b/ipc/sem.c index 6a16f8edf2b..cb5bb2a5df9 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -381,7 +381,7 @@ static void update_queue (struct sem_array * sma) /* hands-off: q will disappear immediately after * writing q->status. */ - smb_wmb(); + smp_wmb(); q->status = error; q = n; } else { -- cgit v1.2.3 From c660439ba90aaaa056f68a5b0fc79f6b9e0506f5 Mon Sep 17 00:00:00 2001 From: Ravikiran G Thirumalai Date: Thu, 22 Dec 2005 14:21:34 -0800 Subject: [PATCH] x86_64/ia64 : Fix compilation error for node_to_first_cpu Fixes a compiler error in node_to_first_cpu, __ffs expects unsigned long as a parameter; instead cpumask_t was being passed. The macro node_to_first_cpu was not yet used in x86_64 and ia64 arches, and so we never hit this. This patch replaces __ffs with first_cpu macro, similar to other arches. Signed-off-by: Alok N Kataria Signed-off-by: Ravikiran G Thirumalai Signed-off-by: Shai Fultheim Signed-off-by: Linus Torvalds --- include/asm-ia64/topology.h | 2 +- include/asm-x86_64/topology.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h index a9f738bf18a..f7c330467e7 100644 --- a/include/asm-ia64/topology.h +++ b/include/asm-ia64/topology.h @@ -38,7 +38,7 @@ /* * Returns the number of the first CPU on Node 'node'. */ -#define node_to_first_cpu(node) (__ffs(node_to_cpumask(node))) +#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node))) /* * Determines the node for a given pci bus diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h index d39ebd5263e..7d82bc56b9f 100644 --- a/include/asm-x86_64/topology.h +++ b/include/asm-x86_64/topology.h @@ -23,7 +23,7 @@ extern int __node_distance(int, int); #define cpu_to_node(cpu) (cpu_to_node[cpu]) #define parent_node(node) (node) -#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) +#define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node])) #define node_to_cpumask(node) (node_to_cpumask[node]) #define pcibus_to_node(bus) ((long)(bus->sysdata)) #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus)); -- cgit v1.2.3 From e5c34a57c8b3a94b8d2b329936f8b1cbcc765307 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Fri, 23 Dec 2005 09:10:03 -0500 Subject: [PATCH] Fix typo in x86_64 __build_write_lock_const assembly Based on __build_read_lock_const, this looked like a bug. [ Indeed. Maybe nobody uses this version? Worth fixing up anyway ] Signed-off-by: Linus Torvalds --- include/asm-x86_64/rwlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-x86_64/rwlock.h b/include/asm-x86_64/rwlock.h index 8a78a4ace53..9942cc39306 100644 --- a/include/asm-x86_64/rwlock.h +++ b/include/asm-x86_64/rwlock.h @@ -64,7 +64,7 @@ ::"a" (rw) : "memory") #define __build_write_lock_const(rw, helper) \ - asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ + asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ "jnz 2f\n" \ "1:\n" \ LOCK_SECTION_START("") \ -- cgit v1.2.3 From 01e33b5a2a153eec74dd87522e264948030b88c1 Mon Sep 17 00:00:00 2001 From: Kurt Huwig Date: Sun, 25 Dec 2005 00:13:08 +0100 Subject: [PATCH] n_r3964: fixed usage of HZ; removed bad include Fix n_r3964 timeouts (hardcoded for 100Hz) Also the include of in 'n_r3964.h' is unnecessary and prevents using the header file in any application that has to include due to duplicate definition of 'struct termio'. Signed-off-by: Linus Torvalds --- include/linux/n_r3964.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h index 2352bcd31a0..db4f3776978 100644 --- a/include/linux/n_r3964.h +++ b/include/linux/n_r3964.h @@ -13,6 +13,10 @@ * L. Haag * * $Log: r3964.h,v $ + * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig + * Fixed HZ usage on 2.6 kernels + * Removed unnecessary include + * * Revision 1.3 2001/03/18 13:02:24 dwmw2 * Fix timer usage, use spinlocks properly. * @@ -45,9 +49,11 @@ #define __LINUX_N_R3964_H__ /* line disciplines for r3964 protocol */ -#include #ifdef __KERNEL__ + +#include + /* * Common ascii handshake characters: */ @@ -58,14 +64,14 @@ #define NAK 0x15 /* - * Timeouts (msecs/10 msecs per timer interrupt): + * Timeouts (from milliseconds to jiffies) */ -#define R3964_TO_QVZ 550/10 -#define R3964_TO_ZVZ 220/10 -#define R3964_TO_NO_BUF 400/10 -#define R3964_NO_TX_ROOM 100/10 -#define R3964_TO_RX_PANIC 4000/10 +#define R3964_TO_QVZ ((550)*HZ/1000) +#define R3964_TO_ZVZ ((220)*HZ/1000) +#define R3964_TO_NO_BUF ((400)*HZ/1000) +#define R3964_NO_TX_ROOM ((100)*HZ/1000) +#define R3964_TO_RX_PANIC ((4000)*HZ/1000) #define R3964_MAX_RETRIES 5 #endif -- cgit v1.2.3 From f89f5948fc10bb973cd452d2e334da207828e228 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 24 Dec 2005 15:47:48 -0800 Subject: Linux v2.6.15-rc7 Ho ho ho. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f4218b5db82..f937f1f4595 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 15 -EXTRAVERSION =-rc6 +EXTRAVERSION =-rc7 NAME=Sliding Snow Leopard # *DOCUMENTATION* -- cgit v1.2.3 From 04333393b930370db0cc29fdf0dbbd08ecd43337 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Mon, 26 Dec 2005 09:58:49 -0600 Subject: [PATCH] Fix Fibre Channel boot oops The oops is characteristic of the underlying device being removed from visibility before the class device, and sure enough we do device_del() before transport_unregister() in the scsi_target_reap() routines. I've no idea why this is suddenly showing up, since the code has been in there since that function was first invented. However, I've confirmed this fixes Andrew Vasquez's boot oops. Signed-off-by: James Bottomley Signed-off-by: Linus Torvalds --- drivers/scsi/scsi_scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index e36c21e06d3..4e6709f448e 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -418,8 +418,9 @@ static void scsi_target_reap_work(void *data) { if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { list_del_init(&starget->siblings); spin_unlock_irqrestore(shost->host_lock, flags); + transport_remove_device(&starget->dev); device_del(&starget->dev); - transport_unregister_device(&starget->dev); + transport_destroy_device(&starget->dev); put_device(&starget->dev); return; -- cgit v1.2.3 From 6f4353d891b5e477528cd0b996e0263fecdf5d5f Mon Sep 17 00:00:00 2001 From: David L Stevens Date: Mon, 26 Dec 2005 17:03:46 -0800 Subject: [IPV6]: Increase default MLD_MAX_MSF to 64. The existing default of 10 is just way too low. Signed-off-by: David L Stevens Signed-off-by: David S. Miller --- net/ipv6/mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index fd939da090c..057d8619ba1 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -170,7 +170,7 @@ static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, #define MLDV2_QQIC(value) MLDV2_EXP(0x80, 4, 3, value) #define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value) -#define IPV6_MLD_MAX_MSF 10 +#define IPV6_MLD_MAX_MSF 64 int sysctl_mld_max_msf = IPV6_MLD_MAX_MSF; -- cgit v1.2.3 From 79cac2a221ce18642550a13bed0f0203514923ea Mon Sep 17 00:00:00 2001 From: David Kimdon Date: Mon, 26 Dec 2005 17:27:10 -0800 Subject: [BR_NETFILTER]: Fix leak if skb traverses > 1 bridge Call nf_bridge_put() before allocating a new nf_bridge structure and potentially overwriting the pointer to a previously allocated one. This fixes a memory leak which can occur when the bridge topology allows for an skb to traverse more than one bridge. Signed-off-by: David Kimdon Signed-off-by: David S. Miller --- net/bridge/br_netfilter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 43a0b35dfe6..23422bd53a5 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c @@ -369,6 +369,7 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook, if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb)) goto inhdr_error; + nf_bridge_put(skb->nf_bridge); if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) return NF_DROP; setup_pre_routing(skb); @@ -452,6 +453,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, skb->ip_summed = CHECKSUM_NONE; } + nf_bridge_put(skb->nf_bridge); if ((nf_bridge = nf_bridge_alloc(skb)) == NULL) return NF_DROP; setup_pre_routing(skb); -- cgit v1.2.3 From a710ce08585e920740ffc84c7f3c82f4081169cf Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 27 Dec 2005 11:10:34 +0000 Subject: [SERIAL] Fix AMBA PL011 sysrq character handling We only want the received character without the status bits for sysrq handling. Signed-off-by: Russell King --- drivers/serial/amba-pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 89d7bd3eaee..d84476ee659 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -160,7 +160,7 @@ pl011_rx_chars(struct uart_amba_port *uap) flag = TTY_FRAME; } - if (uart_handle_sysrq_char(&uap->port, ch, regs)) + if (uart_handle_sysrq_char(&uap->port, ch & 255, regs)) goto ignore_char; uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); -- cgit v1.2.3 From 6732badee0dad467fcc9dd0168af8677b2b1bc2f Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 27 Dec 2005 13:35:15 -0800 Subject: [IPV6]: Fix addrconf dead lock. We need to release idev->lcok before we call addrconf_dad_stop(). It calls ipv6_addr_del(), which will hold idev->lock. Bug spotted by Yasuyuki KOZAKAI . Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/ipv6/addrconf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2a6439e3c91..a60585fd85a 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2467,11 +2467,9 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) return; } - if (idev->if_flags & IF_READY) { - addrconf_dad_kick(ifp); - spin_unlock_bh(&ifp->lock); - } else { + if (!(idev->if_flags & IF_READY)) { spin_unlock_bh(&ifp->lock); + read_unlock_bh(&idev->lock); /* * If the defice is not ready: * - keep it tentative if it is a permanent address. @@ -2479,7 +2477,10 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) */ in6_ifa_hold(ifp); addrconf_dad_stop(ifp); + return; } + addrconf_dad_kick(ifp); + spin_unlock_bh(&ifp->lock); out: read_unlock_bh(&idev->lock); } -- cgit v1.2.3 From 1b93ae64cabe5e28dd5a1f35f96f938ca4f6ae20 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 27 Dec 2005 13:57:59 -0800 Subject: [NET]: Validate socket filters against BPF_MAXINSNS in one spot. Currently the checks are scattered all over and this leads to inconsistencies and even cases where the check is not made. Based upon a patch from Kris Katterjohn. Signed-off-by: David S. Miller --- drivers/net/ppp_generic.c | 3 --- net/core/filter.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 50430f79f8c..1c6d328165b 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -524,9 +524,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) if (copy_from_user(&uprog, arg, sizeof(uprog))) return -EFAULT; - if (uprog.len > BPF_MAXINSNS) - return -EINVAL; - if (!uprog.len) { *p = NULL; return 0; diff --git a/net/core/filter.c b/net/core/filter.c index 2841bfce29d..3a10e0bc90e 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -293,7 +293,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) struct sock_filter *ftest; int pc; - if (((unsigned int)flen >= (~0U / sizeof(struct sock_filter))) || flen == 0) + if (flen == 0 || flen > BPF_MAXINSNS) return -EINVAL; /* check the filter code now */ @@ -360,7 +360,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) int err; /* Make sure new filter is there and in the right amounts. */ - if (fprog->filter == NULL || fprog->len > BPF_MAXINSNS) + if (fprog->filter == NULL) return -EINVAL; fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); -- cgit v1.2.3 From 5ab4a6c81eb3dbe32361791d1535f9153f79b0ed Mon Sep 17 00:00:00 2001 From: David L Stevens Date: Tue, 27 Dec 2005 14:03:00 -0800 Subject: [IPV6] mcast: Fix multiple issues in MLDv2 reports. The below "jumbo" patch fixes the following problems in MLDv2. 1) Add necessary "ntohs" to recent "pskb_may_pull" check [breaks all nonzero source queries on little-endian (!)] 2) Add locking to source filter list [resend of prior patch] 3) fix "mld_marksources()" to a) send nothing when all queried sources are excluded b) send full exclude report when source queried sources are not excluded c) don't schedule a timer when there's nothing to report NOTE: RFC 3810 specifies the source list should be saved and each source reported individually as an IS_IN. This is an obvious DOS path, requiring the host to store and then multicast as many sources as are queried (e.g., millions...). This alternative sends a full, relevant report that's limited to number of sources present on the machine. 4) fix "add_grec()" to send empty-source records when it should The original check doesn't account for a non-empty source list with all sources inactive; the new code keeps that short-circuit case, and also generates the group header with an empty list if needed. 5) fix mca_crcount decrement to be after add_grec(), which needs its original value These issues (other than item #1 ;-) ) were all found by Yan Zheng, much thanks! Signed-off-by: David L Stevens Signed-off-by: David S. Miller --- include/net/if_inet6.h | 1 + net/ipv6/mcast.c | 140 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 111 insertions(+), 30 deletions(-) diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index d8234f9bd4c..eb8afe3499a 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -83,6 +83,7 @@ struct ipv6_mc_socklist struct in6_addr addr; int ifindex; struct ipv6_mc_socklist *next; + rwlock_t sflock; unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ struct ip6_sf_socklist *sflist; }; diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 057d8619ba1..f829a4ad3cc 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -224,6 +224,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr) mc_lst->ifindex = dev->ifindex; mc_lst->sfmode = MCAST_EXCLUDE; + mc_lst->sflock = RW_LOCK_UNLOCKED; mc_lst->sflist = NULL; /* @@ -360,6 +361,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, struct ip6_sf_socklist *psl; int i, j, rv; int leavegroup = 0; + int pmclocked = 0; int err; if (pgsr->gsr_group.ss_family != AF_INET6 || @@ -403,6 +405,9 @@ int ip6_mc_source(int add, int omode, struct sock *sk, pmc->sfmode = omode; } + write_lock_bh(&pmc->sflock); + pmclocked = 1; + psl = pmc->sflist; if (!add) { if (!psl) @@ -475,6 +480,8 @@ int ip6_mc_source(int add, int omode, struct sock *sk, /* update the interface list */ ip6_mc_add_src(idev, group, omode, 1, source, 1); done: + if (pmclocked) + write_unlock_bh(&pmc->sflock); read_unlock_bh(&ipv6_sk_mc_lock); read_unlock_bh(&idev->lock); in6_dev_put(idev); @@ -510,6 +517,8 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) dev = idev->dev; err = 0; + read_lock_bh(&ipv6_sk_mc_lock); + if (gsf->gf_fmode == MCAST_INCLUDE && gsf->gf_numsrc == 0) { leavegroup = 1; goto done; @@ -549,6 +558,8 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) newpsl = NULL; (void) ip6_mc_add_src(idev, group, gsf->gf_fmode, 0, NULL, 0); } + + write_lock_bh(&pmc->sflock); psl = pmc->sflist; if (psl) { (void) ip6_mc_del_src(idev, group, pmc->sfmode, @@ -558,8 +569,10 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) (void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0); pmc->sflist = newpsl; pmc->sfmode = gsf->gf_fmode; + write_unlock_bh(&pmc->sflock); err = 0; done: + read_unlock_bh(&ipv6_sk_mc_lock); read_unlock_bh(&idev->lock); in6_dev_put(idev); dev_put(dev); @@ -592,6 +605,11 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, dev = idev->dev; err = -EADDRNOTAVAIL; + /* + * changes to the ipv6_mc_list require the socket lock and + * a read lock on ip6_sk_mc_lock. We have the socket lock, + * so reading the list is safe. + */ for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) { if (pmc->ifindex != gsf->gf_interface) @@ -614,6 +632,10 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, copy_to_user(optval, gsf, GROUP_FILTER_SIZE(0))) { return -EFAULT; } + /* changes to psl require the socket lock, a read lock on + * on ipv6_sk_mc_lock and a write lock on pmc->sflock. We + * have the socket lock, so reading here is safe. + */ for (i=0; isflock); psl = mc->sflist; if (!psl) { rv = mc->sfmode == MCAST_EXCLUDE; @@ -665,6 +688,7 @@ int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr, if (mc->sfmode == MCAST_EXCLUDE && i < psl->sl_count) rv = 0; } + read_unlock(&mc->sflock); read_unlock(&ipv6_sk_mc_lock); return rv; @@ -1068,7 +1092,8 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime) ma->mca_flags |= MAF_TIMER_RUNNING; } -static void mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, +/* mark EXCLUDE-mode sources */ +static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, struct in6_addr *srcs) { struct ip6_sf_list *psf; @@ -1078,13 +1103,53 @@ static void mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { if (scount == nsrcs) break; - for (i=0; imca_sfcount[MCAST_INCLUDE] || + pmc->mca_sfcount[MCAST_EXCLUDE] != + psf->sf_count[MCAST_EXCLUDE]) + continue; + if (ipv6_addr_equal(&srcs[i], &psf->sf_addr)) { + scount++; + break; + } + } + } + pmc->mca_flags &= ~MAF_GSQUERY; + if (scount == nsrcs) /* all sources excluded */ + return 0; + return 1; +} + +static int mld_marksources(struct ifmcaddr6 *pmc, int nsrcs, + struct in6_addr *srcs) +{ + struct ip6_sf_list *psf; + int i, scount; + + if (pmc->mca_sfmode == MCAST_EXCLUDE) + return mld_xmarksources(pmc, nsrcs, srcs); + + /* mark INCLUDE-mode sources */ + + scount = 0; + for (psf=pmc->mca_sources; psf; psf=psf->sf_next) { + if (scount == nsrcs) + break; + for (i=0; isf_addr)) { psf->sf_gsresp = 1; scount++; break; } + } + } + if (!scount) { + pmc->mca_flags &= ~MAF_GSQUERY; + return 0; } + pmc->mca_flags |= MAF_GSQUERY; + return 1; } int igmp6_event_query(struct sk_buff *skb) @@ -1167,7 +1232,7 @@ int igmp6_event_query(struct sk_buff *skb) /* mark sources to include, if group & source-specific */ if (mlh2->nsrcs != 0) { if (!pskb_may_pull(skb, srcs_offset + - mlh2->nsrcs * sizeof(struct in6_addr))) { + ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) { in6_dev_put(idev); return -EINVAL; } @@ -1203,10 +1268,9 @@ int igmp6_event_query(struct sk_buff *skb) else ma->mca_flags &= ~MAF_GSQUERY; } - if (ma->mca_flags & MAF_GSQUERY) - mld_marksources(ma, ntohs(mlh2->nsrcs), - mlh2->srcs); - igmp6_group_queried(ma, max_delay); + if (!(ma->mca_flags & MAF_GSQUERY) || + mld_marksources(ma, ntohs(mlh2->nsrcs), mlh2->srcs)) + igmp6_group_queried(ma, max_delay); spin_unlock_bh(&ma->mca_lock); if (group_type != IPV6_ADDR_ANY) break; @@ -1281,7 +1345,18 @@ static int is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type, case MLD2_MODE_IS_EXCLUDE: if (gdeleted || sdeleted) return 0; - return !((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp); + if (!((pmc->mca_flags & MAF_GSQUERY) && !psf->sf_gsresp)) { + if (pmc->mca_sfmode == MCAST_INCLUDE) + return 1; + /* don't include if this source is excluded + * in all filters + */ + if (psf->sf_count[MCAST_INCLUDE]) + return 0; + return pmc->mca_sfcount[MCAST_EXCLUDE] == + psf->sf_count[MCAST_EXCLUDE]; + } + return 0; case MLD2_CHANGE_TO_INCLUDE: if (gdeleted || sdeleted) return 0; @@ -1450,7 +1525,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, struct mld2_report *pmr; struct mld2_grec *pgr = NULL; struct ip6_sf_list *psf, *psf_next, *psf_prev, **psf_list; - int scount, first, isquery, truncate; + int scount, stotal, first, isquery, truncate; if (pmc->mca_flags & MAF_NOREPORT) return skb; @@ -1460,25 +1535,13 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, truncate = type == MLD2_MODE_IS_EXCLUDE || type == MLD2_CHANGE_TO_EXCLUDE; + stotal = scount = 0; + psf_list = sdeleted ? &pmc->mca_tomb : &pmc->mca_sources; - if (!*psf_list) { - if (type == MLD2_ALLOW_NEW_SOURCES || - type == MLD2_BLOCK_OLD_SOURCES) - return skb; - if (pmc->mca_crcount || isquery) { - /* make sure we have room for group header and at - * least one source. - */ - if (skb && AVAILABLE(skb) < sizeof(struct mld2_grec)+ - sizeof(struct in6_addr)) { - mld_sendpack(skb); - skb = NULL; /* add_grhead will get a new one */ - } - skb = add_grhead(skb, pmc, type, &pgr); - } - return skb; - } + if (!*psf_list) + goto empty_source; + pmr = skb ? (struct mld2_report *)skb->h.raw : NULL; /* EX and TO_EX get a fresh packet, if needed */ @@ -1491,7 +1554,6 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, } } first = 1; - scount = 0; psf_prev = NULL; for (psf=*psf_list; psf; psf=psf_next) { struct in6_addr *psrc; @@ -1525,7 +1587,7 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, } psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc)); *psrc = psf->sf_addr; - scount++; + scount++; stotal++; if ((type == MLD2_ALLOW_NEW_SOURCES || type == MLD2_BLOCK_OLD_SOURCES) && psf->sf_crcount) { psf->sf_crcount--; @@ -1540,6 +1602,21 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, } psf_prev = psf; } + +empty_source: + if (!stotal) { + if (type == MLD2_ALLOW_NEW_SOURCES || + type == MLD2_BLOCK_OLD_SOURCES) + return skb; + if (pmc->mca_crcount || isquery) { + /* make sure we have room for group header */ + if (skb && AVAILABLE(skb) < sizeof(struct mld2_grec)) { + mld_sendpack(skb); + skb = NULL; /* add_grhead will get a new one */ + } + skb = add_grhead(skb, pmc, type, &pgr); + } + } if (pgr) pgr->grec_nsrcs = htons(scount); @@ -1621,11 +1698,11 @@ static void mld_send_cr(struct inet6_dev *idev) skb = add_grec(skb, pmc, dtype, 1, 1); } if (pmc->mca_crcount) { - pmc->mca_crcount--; if (pmc->mca_sfmode == MCAST_EXCLUDE) { type = MLD2_CHANGE_TO_INCLUDE; skb = add_grec(skb, pmc, type, 1, 0); } + pmc->mca_crcount--; if (pmc->mca_crcount == 0) { mld_clear_zeros(&pmc->mca_tomb); mld_clear_zeros(&pmc->mca_sources); @@ -1659,12 +1736,12 @@ static void mld_send_cr(struct inet6_dev *idev) /* filter mode changes */ if (pmc->mca_crcount) { - pmc->mca_crcount--; if (pmc->mca_sfmode == MCAST_EXCLUDE) type = MLD2_CHANGE_TO_EXCLUDE; else type = MLD2_CHANGE_TO_INCLUDE; skb = add_grec(skb, pmc, type, 0, 0); + pmc->mca_crcount--; } spin_unlock_bh(&pmc->mca_lock); } @@ -2023,6 +2100,9 @@ static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, { int err; + /* callers have the socket lock and a write lock on ipv6_sk_mc_lock, + * so no other readers or writers of iml or its sflist + */ if (iml->sflist == 0) { /* any-source empty exclude case */ return ip6_mc_del_src(idev, &iml->addr, iml->sfmode, 0, NULL, 0); -- cgit v1.2.3 From 67dbb4ea33731415fe09c62149a34f472719ac1d Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Tue, 27 Dec 2005 12:49:33 +1100 Subject: [PATCH] Fix more radeon GART start calculation cases As reported by Jules Villard and some others, the recent GART aperture start reconfiguration causes problems on some setups. What I _think_ might be happening is that the X server is also trying to muck around with the card memory map and is forcing it back into a wrong setting that also happens to no longer match what the DRM wants to do and blows up. There are bugs all over the place in that code (and still some bugs in the DRM as well anyway). This patch attempts to avoid that by using the largest of the 2 values, which I think will cause it to behave as it used to for you and will still fix the problem with machines that have an aperture size smaller than the video memory. Acked-by: Jules Villard Signed-off-by: Linus Torvalds --- drivers/char/drm/radeon_cp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 501e557cbc8..b517ae51580 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c @@ -1312,7 +1312,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) { drm_radeon_private_t *dev_priv = dev->dev_private; - unsigned int mem_size; + unsigned int mem_size, aper_size; DRM_DEBUG("\n"); @@ -1527,7 +1527,9 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) mem_size = RADEON_READ(RADEON_CONFIG_MEMSIZE); if (mem_size == 0) mem_size = 0x800000; - dev_priv->gart_vm_start = dev_priv->fb_location + mem_size; + aper_size = max(RADEON_READ(RADEON_CONFIG_APER_SIZE), mem_size); + + dev_priv->gart_vm_start = dev_priv->fb_location + aper_size; #if __OS_HAS_AGP if (!dev_priv->is_pci) -- cgit v1.2.3 From 091465d7514893a55dcf63e420698b21159c39a7 Mon Sep 17 00:00:00 2001 From: Chris Elmquist Date: Tue, 20 Dec 2005 13:25:19 -0800 Subject: [TG3]: ethtool -d hangs PCIe systems Resubmitting after recommendation to use GET_REG32_1() instead of GET_REG32_LOOP(..., 1). Retested. Problem remains fixed. Prevent tg3_get_regs() from reading reserved and undocumented registers at RX_CPU_BASE and TX_CPU_BASE offsets which caused hostile behavior on PCIe platforms. Acked-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 9 +++++++-- drivers/net/tg3.h | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index cefb0c08a68..ce252c58b3e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -7151,8 +7151,13 @@ do { p = (u32 *)(orig_p + (reg)); \ GET_REG32_LOOP(BUFMGR_MODE, 0x58); GET_REG32_LOOP(RDMAC_MODE, 0x08); GET_REG32_LOOP(WDMAC_MODE, 0x08); - GET_REG32_LOOP(RX_CPU_BASE, 0x280); - GET_REG32_LOOP(TX_CPU_BASE, 0x280); + GET_REG32_1(RX_CPU_MODE); + GET_REG32_1(RX_CPU_STATE); + GET_REG32_1(RX_CPU_PGMCTR); + GET_REG32_1(RX_CPU_HWBKPT); + GET_REG32_1(TX_CPU_MODE); + GET_REG32_1(TX_CPU_STATE); + GET_REG32_1(TX_CPU_PGMCTR); GET_REG32_LOOP(GRCMBOX_INTERRUPT_0, 0x110); GET_REG32_LOOP(FTQ_RESET, 0x120); GET_REG32_LOOP(MSGINT_MODE, 0x0c); diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 94dbcf3537e..890e1635996 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -1124,7 +1124,14 @@ /* 0x280 --> 0x400 unused */ #define RX_CPU_BASE 0x00005000 +#define RX_CPU_MODE 0x00005000 +#define RX_CPU_STATE 0x00005004 +#define RX_CPU_PGMCTR 0x0000501c +#define RX_CPU_HWBKPT 0x00005034 #define TX_CPU_BASE 0x00005400 +#define TX_CPU_MODE 0x00005400 +#define TX_CPU_STATE 0x00005404 +#define TX_CPU_PGMCTR 0x0000541c /* Mailboxes */ #define GRCMBOX_INTERRUPT_0 0x00005800 /* 64-bit */ -- cgit v1.2.3 From a8b554e75b0c14d5e12a11eaea604e536f49da29 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 28 Dec 2005 13:05:41 -0800 Subject: [TG3]: Update driver version and reldate. Signed-off-by: David S. Miller --- drivers/net/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index ce252c58b3e..2fc9893d69e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -68,8 +68,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.46" -#define DRV_MODULE_RELDATE "Dec 19, 2005" +#define DRV_MODULE_VERSION "3.47" +#define DRV_MODULE_RELDATE "Dec 28, 2005" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 -- cgit v1.2.3 From d5784b57d2e08a632b971baae23266121004ef3b Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 28 Dec 2005 13:22:54 -0800 Subject: [SPARC]: Use STABS_DEBUG and DWARF_DEBUG macros in vmlinux.lds.S Signed-off-by: David S. Miller --- arch/sparc/kernel/vmlinux.lds.S | 18 ++++-------------- arch/sparc64/kernel/vmlinux.lds.S | 18 ++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 38938d2e63a..346c19a949f 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -85,19 +85,9 @@ SECTIONS } _end = . ; PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } + + STABS_DEBUG + + DWARF_DEBUG } diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S index 2af0cf0a864..467d13a0d5c 100644 --- a/arch/sparc64/kernel/vmlinux.lds.S +++ b/arch/sparc64/kernel/vmlinux.lds.S @@ -90,19 +90,9 @@ SECTIONS } _end = . ; PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } + + STABS_DEBUG + + DWARF_DEBUG } -- cgit v1.2.3 From 68ca243dd1dc90bd42bae3945e804c1042584920 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 28 Dec 2005 13:27:04 -0800 Subject: [SERMOUSE]: Sun mice speak 5-byte protocol too. Noticed by Christophe Zimmerman, this explains the slow mouse movement with 2.6.x kernels. And checking the 2.4.x drivers/sbus/char/sunmouse.c driver shows we always used a 5-byte protocol with Sun mice in the past. I have no idea how the 3-byte thing got into the 2.6.x driver, but it's surely wrong. Signed-off-by: David S. Miller --- drivers/input/mouse/sermouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 4bf584364d2..2f9a04ae725 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -95,7 +95,7 @@ static void sermouse_process_msc(struct sermouse *sermouse, signed char data, st input_sync(dev); - if (++sermouse->count == (5 - ((sermouse->type == SERIO_SUN) << 1))) + if (++sermouse->count == 5) sermouse->count = 0; } -- cgit v1.2.3 From 516949480d3700cbde4272228a102c84721d6007 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Thu, 29 Dec 2005 17:39:51 +0100 Subject: [PATCH] uml: fix random segfaults at bootup Don't use printk() where "current_thread_info()" is crap. Until when we switch to running on init_stack, current_thread_info() evaluates to crap. Printk uses "current" at times (in detail, ¤t is evaluated with CONFIG_DEBUG_SPINLOCK to check the spinlock owner task). And this leads to random segmentation faults. Exactly, what happens is that ¤t = *(current_thread_info()), i.e. round down $esp and dereference the value. I.e. access the stack below $esp, which causes SIGSEGV on a VM_GROWSDOWN vma (see arch/i386/mm/fault.c). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/os-Linux/start_up.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 37517d49c4a..29a9e3f4376 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c @@ -116,16 +116,16 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode, if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { int exit_with = WEXITSTATUS(status); if (exit_with == 2) - printk("check_ptrace : child exited with status 2. " + printf("check_ptrace : child exited with status 2. " "Serious trouble happening! Try updating your " "host skas patch!\nDisabling SYSEMU support."); - printk("check_ptrace : child exited with exitcode %d, while " + printf("check_ptrace : child exited with exitcode %d, while " "expecting %d; status 0x%x", exit_with, exitcode, status); if (mustpanic) panic("\n"); else - printk("\n"); + printf("\n"); ret = -1; } @@ -183,7 +183,7 @@ static void __init check_sysemu(void) void *stack; int pid, n, status, count=0; - printk("Checking syscall emulation patch for ptrace..."); + printf("Checking syscall emulation patch for ptrace..."); sysemu_supported = 0; pid = start_ptraced_child(&stack); @@ -207,10 +207,10 @@ static void __init check_sysemu(void) goto fail_stopped; sysemu_supported = 1; - printk("OK\n"); + printf("OK\n"); set_using_sysemu(!force_sysemu_disabled); - printk("Checking advanced syscall emulation patch for ptrace..."); + printf("Checking advanced syscall emulation patch for ptrace..."); pid = start_ptraced_child(&stack); if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, @@ -246,7 +246,7 @@ static void __init check_sysemu(void) goto fail_stopped; sysemu_supported = 2; - printk("OK\n"); + printf("OK\n"); if ( !force_sysemu_disabled ) set_using_sysemu(sysemu_supported); @@ -255,7 +255,7 @@ static void __init check_sysemu(void) fail: stop_ptraced_child(pid, stack, 1, 0); fail_stopped: - printk("missing\n"); + printf("missing\n"); } static void __init check_ptrace(void) @@ -263,7 +263,7 @@ static void __init check_ptrace(void) void *stack; int pid, syscall, n, status; - printk("Checking that ptrace can change system call numbers..."); + printf("Checking that ptrace can change system call numbers..."); pid = start_ptraced_child(&stack); if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) @@ -292,7 +292,7 @@ static void __init check_ptrace(void) } } stop_ptraced_child(pid, stack, 0, 1); - printk("OK\n"); + printf("OK\n"); check_sysemu(); } @@ -472,6 +472,8 @@ int can_do_skas(void) int have_devanon = 0; +/* Runs on boot kernel stack - already safe to use printk. */ + void check_devanon(void) { int fd; -- cgit v1.2.3 From 3d0a07e3310c947c048bd01d8d0efa0e4fae5ba9 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Thu, 29 Dec 2005 17:39:54 +0100 Subject: [PATCH] Hostfs: remove unused var Trivial removal of unused variable from this file - doesn't even change the generated assembly code, in fact (gcc should trigger a warning for unused value here). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- fs/hostfs/hostfs_kern.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 4684eb7d48c..3aac164c772 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -910,10 +910,8 @@ static struct inode_operations hostfs_dir_iops = { int hostfs_link_readpage(struct file *file, struct page *page) { char *buffer, *name; - long long start; int err; - start = page->index << PAGE_CACHE_SHIFT; buffer = kmap(page); name = inode_name(page->mapping->host, 0); if(name == NULL) return(-ENOMEM); -- cgit v1.2.3 From 30f04a4efa73dc80bf3f59f3f19ad5a24ac5ac0a Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Thu, 29 Dec 2005 17:39:57 +0100 Subject: [PATCH] uml: hostfs - fix possible PAGE_CACHE_SHIFT overflows Prevent page->index << PAGE_CACHE_SHIFT from overflowing. There is a casting there, but was added without care, so it's at the wrong place. Note the extra parens around the shift - "+" is higher precedence than "<<", leading to a GCC warning which saved all us. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- fs/hostfs/hostfs_kern.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 3aac164c772..b3ad0bd0312 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -501,11 +501,16 @@ int hostfs_commit_write(struct file *file, struct page *page, unsigned from, long long start; int err = 0; - start = (long long) (page->index << PAGE_CACHE_SHIFT) + from; + start = (((long long) page->index) << PAGE_CACHE_SHIFT) + from; buffer = kmap(page); err = write_file(FILE_HOSTFS_I(file)->fd, &start, buffer + from, to - from); if(err > 0) err = 0; + + /* Actually, if !err, write_file has added to-from to start, so, despite + * the appearance, we are comparing i_size against the _last_ written + * location, as we should. */ + if(!err && (start > inode->i_size)) inode->i_size = start; -- cgit v1.2.3 From 74433c0fe105f47e78c1f2267312693870c9ebc3 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Thu, 29 Dec 2005 17:39:59 +0100 Subject: [PATCH] Hostfs: update for new glibc - add missing symbol exports Today, when compiling UML, I got warnings for two used unexported symbols: readdir64 and truncate64. Indeed, my glibc headers are aliasing readdir to readdir64 and truncate to truncate64 (and so on). I'm then adding additional exports. Since I've no idea if the symbols where always provided in the supported glibc's, I've added weak definitions too. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/os-Linux/user_syms.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index 56d3f870926..8da6ab31152 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c @@ -34,6 +34,11 @@ EXPORT_SYMBOL(strstr); int sym(void); \ EXPORT_SYMBOL(sym); +extern void readdir64(void) __attribute__((weak)); +EXPORT_SYMBOL(readdir64); +extern void truncate64(void) __attribute__((weak)); +EXPORT_SYMBOL(truncate64); + #ifdef SUBARCH_i386 EXPORT_SYMBOL(vsyscall_ehdr); EXPORT_SYMBOL(vsyscall_end); -- cgit v1.2.3 From 63b44442416a243f05881b0dd094b621a46ab4b3 Mon Sep 17 00:00:00 2001 From: Paolo 'Blaisorblade' Giarrusso Date: Thu, 29 Dec 2005 17:40:02 +0100 Subject: [PATCH] uml: fix compilation with CONFIG_MODE_TT disabled Fix UML compilation when SKAS mode is disabled. Indeed, we were compiling SKAS-only object files, which failed due to some SKAS-only headers being excluded from the search path. Thanks to the bug report from Pekka J Enberg. Acked-by: Pekka J Enberg Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Linus Torvalds --- arch/um/sys-i386/Makefile | 8 +++++--- arch/um/sys-x86_64/Makefile | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index 150059dbee1..f5fd5b0156d 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile @@ -1,6 +1,8 @@ -obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ - ptrace_user.o semaphore.o signal.o sigcontext.o stub.o stub_segv.o \ - syscalls.o sysrq.o sys_call_table.o +obj-y := bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ + ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \ + sys_call_table.o + +obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 00b2025427d..a351091fbd9 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile @@ -6,8 +6,9 @@ #XXX: why into lib-y? lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \ - ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \ - stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o + ptrace.o ptrace_user.o sigcontext.o signal.o syscalls.o \ + syscall_table.o sysrq.o thunk.o +lib-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o obj-y := ksyms.o obj-$(CONFIG_MODULES) += module.o um_module.o -- cgit v1.2.3 From ee025949586f80effa634ff273c2444795472780 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 28 Dec 2005 20:01:04 -0500 Subject: [PATCH] fix ia64 compile failure with gcc4.1 __get_unaligned creates a typeof the var its passed, and writes to it, which on gcc4.1, spits out the following error: drivers/char/vc_screen.c: In function 'vcs_write': drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val' Signed-off-by: Dave Jones [ The "right" fix would be to try to fix but that's hard to do with the tools gcc gives us. So this simpler patch is preferable -- Linus ] Signed-off-by: Linus Torvalds --- drivers/char/vc_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index f66c7ad6fd3..3c1dafaa344 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c @@ -419,7 +419,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) while (this_round > 1) { unsigned short w; - w = get_unaligned(((const unsigned short *)con_buf0)); + w = get_unaligned(((unsigned short *)con_buf0)); vcs_scr_writew(vc, w, org++); con_buf0 += 2; this_round -= 2; -- cgit v1.2.3 From f873e3e88d52774633968826c5b7fa7bf9697999 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 28 Dec 2005 20:44:48 -0500 Subject: [PATCH] Input: aiptek - fix Y axis setup This patch fixes a typo introduced by conversion to dynamic input_dev allocation. Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/usb/input/aiptek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 1c3b472a3bc..0e2505c073d 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c @@ -2103,7 +2103,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) * values. */ input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0); - input_set_abs_params(inputdev, ABS_X, 0, 2249, 0, 0); + input_set_abs_params(inputdev, ABS_Y, 0, 2249, 0, 0); input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0); input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); -- cgit v1.2.3 From 576fc0978b6b3673fce6d4b405f36449e508826c Mon Sep 17 00:00:00 2001 From: Ravikiran G Thirumalai Date: Thu, 29 Dec 2005 13:06:11 +0100 Subject: [PATCH] x86_64: Fix incorrect node_present_pages on NUMA Currently, we do not pass the correct start_pfn to e820_hole_size, to calculate holes. Following patch fixes that. The bug results in incorrect number of node_present_pages for each pgdat and causes ugly output in /sys and probably VM inbalances. Signed-off-by: Alok N Kataria Signed-off-by: Ravikiran Thirumalai Signed-off-by: Andi Kleen Sighed-off-by: Shair Fultheim Sighed-off-by: Linus Torvalds --- arch/x86_64/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 286f6a624c3..c016dfe8478 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c @@ -348,7 +348,7 @@ size_zones(unsigned long *z, unsigned long *h, } /* Compute holes */ - w = 0; + w = start_pfn; for (i = 0; i < MAX_NR_ZONES; i++) { unsigned long s = w; w += z[i]; -- cgit v1.2.3 From e597cb32e95a6c38e9ead981b169ef2974ccfec0 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Thu, 29 Dec 2005 10:46:29 +1100 Subject: [PATCH] ppc64: htab_initialize_secondary cannot be marked __init Sonny has noticed hotplug CPU on ppc64 is broken in 2.6.15-*. One of the problems is that htab_initialize_secondary is called when a cpu is being brought up, but it is marked __init. Signed-off-by: Anton Blanchard Acked-by: Paul Mackerras Signed-off-by: Linus Torvalds --- arch/powerpc/mm/hash_utils_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index a33583f3b0e..a606504678b 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -514,7 +514,7 @@ void __init htab_initialize(void) #undef KB #undef MB -void __init htab_initialize_secondary(void) +void htab_initialize_secondary(void) { if (!platform_is_lpar()) mtspr(SPRN_SDR1, _SDR1); -- cgit v1.2.3 From 80c72579f74fcfcd63e27c5e317091cb35bb1f12 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 28 Dec 2005 21:02:57 +0100 Subject: [PATCH] Fix recursive config dependency for SAA7134 Fix the cyclic dependency issue between CONFIG_SAA7134_ALSA and CONFIG_SAA7134_OSS (credits to Mauro Carvalho Chehab.) Signed-off-by: Jean Delvare Acked-by: Mauro Carvalho Chehab Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index c0f604a6fe4..86e1bb391a4 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -14,7 +14,7 @@ config VIDEO_SAA7134 config VIDEO_SAA7134_ALSA tristate "Philips SAA7134 DMA audio support" - depends on VIDEO_SAA7134 && SOUND && SND && (!VIDEO_SAA7134_OSS || VIDEO_SAA7134_OSS = m) + depends on VIDEO_SAA7134 && SND select SND_PCM_OSS ---help--- This is a video4linux driver for direct (DMA) audio in @@ -25,7 +25,7 @@ config VIDEO_SAA7134_ALSA config VIDEO_SAA7134_OSS tristate "Philips SAA7134 DMA audio support (OSS, DEPRECATED)" - depends on VIDEO_SAA7134 && SOUND_PRIME && (!VIDEO_SAA7134_ALSA || VIDEO_SAA7134_ALSA = m) + depends on VIDEO_SAA7134 && SOUND_PRIME && (!VIDEO_SAA7134_ALSA || (VIDEO_SAA7134_ALSA=m && m)) ---help--- This is a video4linux driver for direct (DMA) audio in Philips SAA713x based TV cards using OSS -- cgit v1.2.3 From 392c14beaca2ee85a98d0c6b453501be67423a20 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 29 Dec 2005 13:01:54 -0800 Subject: Revert radeon AGP aperture offset changes This reverts the series of commits 67dbb4ea33731415fe09c62149a34f472719ac1d 281ab031a8c9e5b593142eb4ec59a87faae8676a 47807ce381acc34a7ffee2b42e35e96c0f322e52 that changed the GART VM start offset. It fixed some machines, but seems to continually interact badly with some X versions. Quoth Ben Herrenschmidt: "So I think at this point, the best is that we keep the old bogus code that at least is consistent with the bug in the server. I'm working on a big patch to X that reworks the memory map stuff completely and fixes those issues on the server side, I'll do a DRM patch matching this X fix as well so that the memory map is only ever set in one place and with what I hope is a correct algorithm..." Signed-off-by: Linus Torvalds --- drivers/char/drm/radeon_cp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index b517ae51580..342302d4674 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c @@ -1312,8 +1312,6 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) { drm_radeon_private_t *dev_priv = dev->dev_private; - unsigned int mem_size, aper_size; - DRM_DEBUG("\n"); dev_priv->is_pci = init->is_pci; @@ -1523,13 +1521,8 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init) + dev_priv->fb_location) >> 10)); dev_priv->gart_size = init->gart_size; - - mem_size = RADEON_READ(RADEON_CONFIG_MEMSIZE); - if (mem_size == 0) - mem_size = 0x800000; - aper_size = max(RADEON_READ(RADEON_CONFIG_APER_SIZE), mem_size); - - dev_priv->gart_vm_start = dev_priv->fb_location + aper_size; + dev_priv->gart_vm_start = dev_priv->fb_location + + RADEON_READ(RADEON_CONFIG_APER_SIZE); #if __OS_HAS_AGP if (!dev_priv->is_pci) -- cgit v1.2.3 From 9e625ff8a37aefcc177b19614ffcffb5bc6eeea1 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 29 Dec 2005 22:07:30 +0100 Subject: [PATCH] Simplify the VIDEO_SAA7134_OSS Kconfig dependency line Thanks to Roman Zippel for the suggestion. Signed-off-by: Jean Delvare [ Short explanation: Kconfig uses ternary math: n/m/y, and !m is m ] Signed-off-by: Linus Torvalds --- drivers/media/video/saa7134/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index 86e1bb391a4..8a5c3e71b37 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -25,7 +25,7 @@ config VIDEO_SAA7134_ALSA config VIDEO_SAA7134_OSS tristate "Philips SAA7134 DMA audio support (OSS, DEPRECATED)" - depends on VIDEO_SAA7134 && SOUND_PRIME && (!VIDEO_SAA7134_ALSA || (VIDEO_SAA7134_ALSA=m && m)) + depends on VIDEO_SAA7134 && SOUND_PRIME && !VIDEO_SAA7134_ALSA ---help--- This is a video4linux driver for direct (DMA) audio in Philips SAA713x based TV cards using OSS -- cgit v1.2.3 From 1994754412536d4ab902a81530b49bcaf496a59c Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 29 Dec 2005 22:19:07 -0500 Subject: [PATCH] Input: kbtab - fix Y axis setup This patch fixes a typo introduced by conversion to dynamic input_dev allocation. Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/usb/input/kbtab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c index a248664b5d1..fd48e74e78e 100644 --- a/drivers/usb/input/kbtab.c +++ b/drivers/usb/input/kbtab.c @@ -159,7 +159,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH); input_dev->mscbit[0] |= BIT(MSC_SERIAL); input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); - input_set_abs_params(input_dev, ABS_X, 0, 0x1750, 4, 0); + input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); endpoint = &intf->cur_altsetting->endpoint[0].desc; -- cgit v1.2.3 From ae5536d6f7f9b51f7a0451421eade1988cfd7126 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 29 Dec 2005 22:19:08 -0500 Subject: [PATCH] Input: warrior - fix HAT0Y axis setup This patch fixes a typo introduced by conversion to dynamic input_dev allocation. Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/input/joystick/warrior.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c index 99a642d2a1f..1849b176cf1 100644 --- a/drivers/input/joystick/warrior.c +++ b/drivers/input/joystick/warrior.c @@ -172,7 +172,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv) input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 8); input_set_abs_params(input_dev, ABS_THROTTLE, -112, 112, 0, 0); input_set_abs_params(input_dev, ABS_HAT0X, -1, 1, 0, 0); - input_set_abs_params(input_dev, ABS_HAT0X, -1, 1, 0, 0); + input_set_abs_params(input_dev, ABS_HAT0Y, -1, 1, 0, 0); serio_set_drvdata(serio, warrior); -- cgit v1.2.3 From 40c37213a081990b1d3778f57630f97df75a7ec1 Mon Sep 17 00:00:00 2001 From: Denny Priebe Date: Thu, 29 Dec 2005 22:19:09 -0500 Subject: [PATCH] Input: wacom - fix X axis setup This patch fixes a typo introduced by conversion to dynamic input_dev allocation. Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/usb/input/wacom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index aea1cfae34c..dc099bbe12b 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c @@ -854,7 +854,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); - input_set_abs_params(input_dev, ABS_X, 0, wacom->features->y_max, 4, 0); + input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0); input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); -- cgit v1.2.3 From 8b90db0df7187a01fb7177f1f812123138f562cf Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 30 Dec 2005 08:39:10 -0800 Subject: Insanity avoidance in /proc The old /proc interfaces were never updated to use loff_t, and are just generally broken. Now, we should be using the seq_file interface for all of the proc files, but converting the legacy functions is more work than most people care for and has little upside.. But at least we can make the non-LFS rules explicit, rather than just insanely wrapping the offset or something. Signed-off-by: Linus Torvalds --- fs/proc/generic.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index b638fb50074..72b431d0a0a 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -54,6 +54,18 @@ proc_file_read(struct file *file, char __user *buf, size_t nbytes, ssize_t n, count; char *start; struct proc_dir_entry * dp; + unsigned long long pos; + + /* + * Gaah, please just use "seq_file" instead. The legacy /proc + * interfaces cut loff_t down to off_t for reads, and ignore + * the offset entirely for writes.. + */ + pos = *ppos; + if (pos > MAX_NON_LFS) + return 0; + if (nbytes > MAX_NON_LFS - pos) + nbytes = MAX_NON_LFS - pos; dp = PDE(inode); if (!(page = (char*) __get_free_page(GFP_KERNEL))) @@ -202,30 +214,17 @@ proc_file_write(struct file *file, const char __user *buffer, static loff_t proc_file_lseek(struct file *file, loff_t offset, int orig) { - lock_kernel(); - - switch (orig) { - case 0: - if (offset < 0) - goto out; - file->f_pos = offset; - unlock_kernel(); - return(file->f_pos); - case 1: - if (offset + file->f_pos < 0) - goto out; - file->f_pos += offset; - unlock_kernel(); - return(file->f_pos); - case 2: - goto out; - default: - goto out; - } - -out: - unlock_kernel(); - return -EINVAL; + loff_t retval = -EINVAL; + switch (orig) { + case 1: + offset += file->f_pos; + /* fallthrough */ + case 0: + if (offset < 0 || offset > MAX_NON_LFS) + break; + file->f_pos = retval = offset; + } + return retval; } static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) -- cgit v1.2.3 From 8febdd85adaa41fa1fc1cb31286210fc2cd3ed0c Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 30 Dec 2005 17:18:53 -0800 Subject: sysctl: don't overflow the user-supplied buffer with '\0' If the string was too long to fit in the user-supplied buffer, the sysctl layer would zero-terminate it by writing past the end of the buffer. Don't do that. Noticed by Yi Yang Signed-off-by: Linus Torvalds --- kernel/sysctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 9990e10192e..ad0425a8f70 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2201,14 +2201,12 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, if (get_user(len, oldlenp)) return -EFAULT; if (len) { - l = strlen(table->data); + l = strlen(table->data)+1; if (len > l) len = l; if (len >= table->maxlen) len = table->maxlen; if(copy_to_user(oldval, table->data, len)) return -EFAULT; - if(put_user(0, ((char __user *) oldval) + len)) - return -EFAULT; if(put_user(len, oldlenp)) return -EFAULT; } -- cgit v1.2.3 From 82c9df820112c6286a8e8fbe482e94b65b49062c Mon Sep 17 00:00:00 2001 From: Yi Yang Date: Fri, 30 Dec 2005 16:37:10 +0800 Subject: [PATCH] Fix false old value return of sysctl For the sysctl syscall, if the user wants to get the old value of a sysctl entry and set a new value for it in the same syscall, the old value is always overwritten by the new value if the sysctl entry is of string type and if the user sets its strategy to sysctl_string. This issue lies in the strategy being run twice if the strategy is set to sysctl_string, the general strategy sysctl_string always returns 0 if success. Such strategy routines as sysctl_jiffies and sysctl_jiffies_ms return 1 because they do read and write for the sysctl entry. The strategy routine sysctl_string return 0 although it actually read and write the sysctl entry. According to my analysis, if a strategy routine do read and write, it should return 1, if it just does some necessary check but not read and write, it should return 0, for example sysctl_intvec. Signed-off-by: Yi Yang Signed-off-by: Linus Torvalds --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ad0425a8f70..e5102ea6e10 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2221,7 +2221,7 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen, len--; ((char *) table->data)[len] = 0; } - return 0; + return 1; } /* -- cgit v1.2.3