Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150924
b: refs/heads/master
c: adf76cf
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jun 12, 2009
1 parent d93860e commit ce93eae
Show file tree
Hide file tree
Showing 25 changed files with 367 additions and 196 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 24992eacd8a9f4af286bdaaab627b6802ceb8bce
refs/heads/master: adf76cfe24dab32a54e2dd1f51534cea8277f32a
7 changes: 3 additions & 4 deletions trunk/drivers/isdn/hardware/mISDN/hfcpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,10 +1806,9 @@ init_card(struct hfc_pci *hc)
printk(KERN_WARNING
"HFC PCI: IRQ(%d) getting no interrupts "
"during init %d\n", hc->irq, 4 - cnt);
if (cnt == 1) {
spin_unlock_irqrestore(&hc->lock, flags);
return -EIO;
} else {
if (cnt == 1)
break;
else {
reset_hfcpci(hc);
cnt--;
}
Expand Down
41 changes: 30 additions & 11 deletions trunk/drivers/isdn/hisax/hfc_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
del_timer(&cs->hw.hfcpci.timer);
kfree(cs->hw.hfcpci.share_start);
cs->hw.hfcpci.share_start = NULL;
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
cs->hw.hfcpci.fifos = NULL;
iounmap((void *)cs->hw.hfcpci.pci_io);
}

Expand Down Expand Up @@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
dev_hfcpci);
i++;
if (tmp_hfcpci) {
dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
if (pci_enable_device(tmp_hfcpci))
continue;
if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
printk(KERN_WARNING
"HiSax hfc_pci: No suitable DMA available.\n");
continue;
}
if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
printk(KERN_WARNING
"HiSax hfc_pci: No suitable consistent DMA available.\n");
continue;
}
pci_set_master(tmp_hfcpci);
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
continue;
Expand Down Expand Up @@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
return (0);
}

/* Allocate memory for FIFOS */
/* Because the HFC-PCI needs a 32K physical alignment, we */
/* need to allocate the double mem and align the address */
if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
0x8000, &cs->hw.hfcpci.dma);
if (!cs->hw.hfcpci.fifos) {
printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
return 0;
}
if (cs->hw.hfcpci.dma & 0x7fff) {
printk(KERN_WARNING
"HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
(u_long)cs->hw.hfcpci.dma);
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
return 0;
}
cs->hw.hfcpci.fifos = (void *)
(((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
printk(KERN_INFO
"HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
"HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
cs->hw.hfcpci.pci_io,
cs->hw.hfcpci.fifos,
(u_int) virt_to_bus(cs->hw.hfcpci.fifos),
(u_long)cs->hw.hfcpci.dma,
cs->irq, HZ);

spin_lock_irqsave(&cs->lock, flags);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/hisax/hisax.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ struct hfcPCI_hw {
int nt_timer;
struct pci_dev *dev;
unsigned char *pci_io; /* start of PCI IO memory */
void *share_start; /* shared memory for Fifos start */
dma_addr_t dma; /* dma handle for Fifos */
void *fifos; /* FIFO memory */
int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
struct timer_list timer;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/i4l/isdn_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
int retval, line;

line = tty->index;
if (line < 0 || line > ISDN_MAX_CHANNELS)
if (line < 0 || line >= ISDN_MAX_CHANNELS)
return -ENODEV;
info = &dev->mdm.info[line];
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/isdn/mISDN/dsp_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,19 @@ static ssize_t
attr_show_args(struct device *dev, struct device_attribute *attr, char *buf)
{
struct mISDN_dsp_element *elem = dev_get_drvdata(dev);
ssize_t len = 0;
int i = 0;
int i;
char *p = buf;

*buf = 0;
for (; i < elem->num_args; ++i)
len = sprintf(buf, "%sName: %s\n%s%s%sDescription: %s\n"
"\n", buf,
for (i = 0; i < elem->num_args; i++)
p += sprintf(p, "Name: %s\n%s%s%sDescription: %s\n\n",
elem->args[i].name,
elem->args[i].def ? "Default: " : "",
elem->args[i].def ? elem->args[i].def : "",
elem->args[i].def ? "\n" : "",
elem->args[i].desc);

return len;
return p - buf;
}

static struct device_attribute element_attributes[] = {
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/isdn/mISDN/tei.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,7 @@ static int
ph_data_ind(struct manager *mgr, struct sk_buff *skb)
{
int ret = -EINVAL;
struct layer2 *l2;
u_long flags;
struct layer2 *l2, *nl2;
u_char mt;

if (skb->len < 8) {
Expand Down Expand Up @@ -908,11 +907,9 @@ ph_data_ind(struct manager *mgr, struct sk_buff *skb)
new_tei_req(mgr, &skb->data[4]);
goto done;
}
read_lock_irqsave(&mgr->lock, flags);
list_for_each_entry(l2, &mgr->layer2, list) {
list_for_each_entry_safe(l2, nl2, &mgr->layer2, list) {
tei_ph_data_ind(l2->tm, mt, &skb->data[4], skb->len - 4);
}
read_unlock_irqrestore(&mgr->lock, flags);
done:
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/atl1e/atl1e_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
}

if (skb_is_gso(skb)) {
if (skb->protocol == ntohs(ETH_P_IP) ||
if (skb->protocol == htons(ETH_P_IP) ||
(skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6)) {
proto_hdr_len = skb_transport_offset(skb) +
tcp_hdrlen(skb);
Expand Down Expand Up @@ -1878,7 +1878,7 @@ static int atl1e_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
TPD_VLAN_SHIFT;
}

if (skb->protocol == ntohs(ETH_P_8021Q))
if (skb->protocol == htons(ETH_P_8021Q))
tpd->word3 |= 1 << TPD_VL_TAGGED_SHIFT;

if (skb_network_offset(skb) != ETH_HLEN)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/atlx/atl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)

mss = skb_shinfo(skb)->gso_size;
if (mss) {
if (skb->protocol == ntohs(ETH_P_IP)) {
if (skb->protocol == htons(ETH_P_IP)) {
proto_hdr_len = (skb_transport_offset(skb) +
tcp_hdrlen(skb));
if (unlikely(proto_hdr_len > len)) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ioc3-eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len)
* case where the checksum is right the higher layers will still
* drop the packet as appropriate.
*/
if (eh->h_proto != ntohs(ETH_P_IP))
if (eh->h_proto != htons(ETH_P_IP))
return;

ih = (struct iphdr *) ((char *)eh + ETH_HLEN);
Expand Down
24 changes: 16 additions & 8 deletions trunk/drivers/net/wimax/i2400m/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,15 @@ void i2400m_report_hook(struct i2400m *i2400m,
* it. */
case I2400M_MT_REPORT_POWERSAVE_READY: /* zzzzz */
if (l3l4_hdr->status == cpu_to_le16(I2400M_MS_DONE_OK)) {
d_printf(1, dev, "ready for powersave, requesting\n");
i2400m_cmd_enter_powersave(i2400m);
if (i2400m_power_save_disabled)
d_printf(1, dev, "ready for powersave, "
"not requesting (disabled by module "
"parameter)\n");
else {
d_printf(1, dev, "ready for powersave, "
"requesting\n");
i2400m_cmd_enter_powersave(i2400m);
}
}
break;
};
Expand Down Expand Up @@ -688,8 +695,9 @@ struct sk_buff *i2400m_msg_to_dev(struct i2400m *i2400m,
d_fnstart(3, dev, "(i2400m %p buf %p len %zu)\n",
i2400m, buf, buf_len);

rmb(); /* Make sure we see what i2400m_dev_reset_handle() */
if (i2400m->boot_mode)
return ERR_PTR(-ENODEV);
return ERR_PTR(-EL3RST);

msg_l3l4_hdr = buf;
/* Check msg & payload consistency */
Expand Down Expand Up @@ -1389,16 +1397,16 @@ int i2400m_dev_initialize(struct i2400m *i2400m)
*
* @i2400m: device descriptor
*
* Gracefully stops the device, moving it to the lowest power
* consumption state possible.
* Release resources acquired during the running of the device; in
* theory, should also tell the device to go to sleep, switch off the
* radio, all that, but at this point, in most cases (driver
* disconnection, reset handling) we can't even talk to the device.
*/
void i2400m_dev_shutdown(struct i2400m *i2400m)
{
int result = -ENODEV;
struct device *dev = i2400m_dev(i2400m);

d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
result = i2400m->bus_reset(i2400m, I2400M_RT_WARM);
d_fnend(3, dev, "(i2400m %p) = void [%d]\n", i2400m, result);
d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
return;
}
40 changes: 28 additions & 12 deletions trunk/drivers/net/wimax/i2400m/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ module_param_named(rx_reorder_disabled, i2400m_rx_reorder_disabled, int, 0644);
MODULE_PARM_DESC(rx_reorder_disabled,
"If true, RX reordering will be disabled.");

int i2400m_power_save_disabled; /* 0 (power saving enabled) by default */
module_param_named(power_save_disabled, i2400m_power_save_disabled, int, 0644);
MODULE_PARM_DESC(power_save_disabled,
"If true, the driver will not tell the device to enter "
"power saving mode when it reports it is ready for it. "
"False by default (so the device is told to do power "
"saving).");

/**
* i2400m_queue_work - schedule work on a i2400m's queue
*
Expand Down Expand Up @@ -172,7 +180,6 @@ int i2400m_schedule_work(struct i2400m *i2400m,
int result;
struct i2400m_work *iw;

BUG_ON(i2400m->work_queue == NULL);
result = -ENOMEM;
iw = kzalloc(sizeof(*iw), gfp_flags);
if (iw == NULL)
Expand Down Expand Up @@ -377,6 +384,11 @@ int i2400m_check_mac_addr(struct i2400m *i2400m)
* Uploads firmware and brings up all the resources needed to be able
* to communicate with the device.
*
* The workqueue has to be setup early, at least before RX handling
* (it's only real user for now) so it can process reports as they
* arrive. We also want to destroy it if we retry, to make sure it is
* flushed...easier like this.
*
* TX needs to be setup before the bus-specific code (otherwise on
* shutdown, the bus-tx code could try to access it).
*/
Expand All @@ -387,7 +399,7 @@ int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags)
struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
struct net_device *net_dev = wimax_dev->net_dev;
struct device *dev = i2400m_dev(i2400m);
int times = 3;
int times = i2400m->bus_bm_retries;

d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
retry:
Expand All @@ -402,15 +414,15 @@ int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags)
result = i2400m_rx_setup(i2400m);
if (result < 0)
goto error_rx_setup;
result = i2400m->bus_dev_start(i2400m);
if (result < 0)
goto error_bus_dev_start;
i2400m->work_queue = create_singlethread_workqueue(wimax_dev->name);
if (i2400m->work_queue == NULL) {
result = -ENOMEM;
dev_err(dev, "cannot create workqueue\n");
goto error_create_workqueue;
}
result = i2400m->bus_dev_start(i2400m);
if (result < 0)
goto error_bus_dev_start;
result = i2400m_firmware_check(i2400m); /* fw versions ok? */
if (result < 0)
goto error_fw_check;
Expand All @@ -432,17 +444,17 @@ int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags)
error_dev_initialize:
error_check_mac_addr:
error_fw_check:
destroy_workqueue(i2400m->work_queue);
error_create_workqueue:
i2400m->bus_dev_stop(i2400m);
error_bus_dev_start:
destroy_workqueue(i2400m->work_queue);
error_create_workqueue:
i2400m_rx_release(i2400m);
error_rx_setup:
i2400m_tx_release(i2400m);
error_tx_setup:
error_bootstrap:
if (result == -ERESTARTSYS && times-- > 0) {
flags = I2400M_BRI_SOFT;
if (result == -EL3RST && times-- > 0) {
flags = I2400M_BRI_SOFT|I2400M_BRI_MAC_REINIT;
goto retry;
}
d_fnend(3, dev, "(net_dev %p [i2400m %p]) = %d\n",
Expand Down Expand Up @@ -471,7 +483,9 @@ int i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri bm_flags)
*
* Returns: 0 if ok, < 0 errno code on error.
*
* Releases all the resources allocated to communicate with the device.
* Releases all the resources allocated to communicate with the
* device. Note we cannot destroy the workqueue earlier as until RX is
* fully destroyed, it could still try to schedule jobs.
*/
static
void __i2400m_dev_stop(struct i2400m *i2400m)
Expand All @@ -483,8 +497,8 @@ void __i2400m_dev_stop(struct i2400m *i2400m)
wimax_state_change(wimax_dev, __WIMAX_ST_QUIESCING);
i2400m_dev_shutdown(i2400m);
i2400m->ready = 0;
destroy_workqueue(i2400m->work_queue);
i2400m->bus_dev_stop(i2400m);
destroy_workqueue(i2400m->work_queue);
i2400m_rx_release(i2400m);
i2400m_tx_release(i2400m);
wimax_state_change(wimax_dev, WIMAX_ST_DOWN);
Expand Down Expand Up @@ -546,7 +560,7 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
* i2400m_dev_stop() [we are shutting down anyway, so
* ignore it] or we are resetting somewhere else. */
dev_err(dev, "device rebooted\n");
i2400m_msg_to_dev_cancel_wait(i2400m, -ERESTARTSYS);
i2400m_msg_to_dev_cancel_wait(i2400m, -EL3RST);
complete(&i2400m->msg_completion);
goto out;
}
Expand Down Expand Up @@ -596,6 +610,8 @@ void __i2400m_dev_reset_handle(struct work_struct *ws)
*/
int i2400m_dev_reset_handle(struct i2400m *i2400m)
{
i2400m->boot_mode = 1;
wmb(); /* Make sure i2400m_msg_to_dev() sees boot_mode */
return i2400m_schedule_work(i2400m, __i2400m_dev_reset_handle,
GFP_ATOMIC);
}
Expand Down
Loading

0 comments on commit ce93eae

Please sign in to comment.