git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
drivers
/
net
/
irda
/
stir4200.c
diff --git
a/drivers/net/irda/stir4200.c
b/drivers/net/irda/stir4200.c
index
81282d9
..
31867e4
100644
(file)
--- a/
drivers/net/irda/stir4200.c
+++ b/
drivers/net/irda/stir4200.c
@@
-46,7
+46,6
@@
#include <linux/time.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/time.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
-#include <linux/suspend.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/usb.h>
@@
-209,7
+208,7
@@
static int write_reg(struct stir_cb *stir, __u16 reg, __u8 value)
REQ_WRITE_SINGLE,
USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_DEVICE,
value, reg, NULL, 0,
REQ_WRITE_SINGLE,
USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_DEVICE,
value, reg, NULL, 0,
-
msecs_to_jiffies(CTRL_TIMEOUT)
);
+
CTRL_TIMEOUT
);
}
/* Send control message to read multiple registers */
}
/* Send control message to read multiple registers */
@@
-222,7
+221,7
@@
static inline int read_reg(struct stir_cb *stir, __u16 reg,
REQ_READ_REG,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, reg, data, count,
REQ_READ_REG,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, reg, data, count,
-
msecs_to_jiffies(CTRL_TIMEOUT)
);
+
CTRL_TIMEOUT
);
}
static inline int isfir(u32 speed)
}
static inline int isfir(u32 speed)
@@
-520,11
+519,6
@@
static int change_speed(struct stir_cb *stir, unsigned speed)
found:
pr_debug("speed change from %d to %d\n", stir->speed, speed);
found:
pr_debug("speed change from %d to %d\n", stir->speed, speed);
- /* sometimes needed to get chip out of stuck state */
- err = usb_reset_device(stir->usbdev);
- if (err)
- goto out;
-
/* Reset modulator */
err = write_reg(stir, REG_CTRL1, CTRL1_SRESET);
if (err)
/* Reset modulator */
err = write_reg(stir, REG_CTRL1, CTRL1_SRESET);
if (err)
@@
-575,7
+569,7
@@
static int change_speed(struct stir_cb *stir, unsigned speed)
*/
static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
{
*/
static int stir_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
{
- struct stir_cb *stir = netdev
->priv
;
+ struct stir_cb *stir = netdev
_priv(netdev)
;
netif_stop_queue(netdev);
netif_stop_queue(netdev);
@@
-677,16
+671,16
@@
static void turnaround_delay(const struct stir_cb *stir, long us)
return;
do_gettimeofday(&now);
return;
do_gettimeofday(&now);
- us -= (now.tv_sec - stir->rx_time.tv_sec) * USEC_PER_SEC;
+ if (now.tv_sec - stir->rx_time.tv_sec > 0)
+ us -= USEC_PER_SEC;
us -= now.tv_usec - stir->rx_time.tv_usec;
if (us < 10)
return;
ticks = us / (1000000 / HZ);
us -= now.tv_usec - stir->rx_time.tv_usec;
if (us < 10)
return;
ticks = us / (1000000 / HZ);
- if (ticks > 0) {
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1 + ticks);
- } else
+ if (ticks > 0)
+ schedule_timeout_interruptible(1 + ticks);
+ else
udelay(us);
}
udelay(us);
}
@@
-710,7
+704,7
@@
static int receive_start(struct stir_cb *stir)
static void receive_stop(struct stir_cb *stir)
{
stir->receiving = 0;
static void receive_stop(struct stir_cb *stir)
{
stir->receiving = 0;
- usb_
unlink
_urb(stir->rx_urb);
+ usb_
kill
_urb(stir->rx_urb);
if (stir->rx_buff.in_frame)
stir->stats.collisions++;
if (stir->rx_buff.in_frame)
stir->stats.collisions++;
@@
-746,7
+740,7
@@
static void stir_send(struct stir_cb *stir, struct sk_buff *skb)
if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
stir->io_buf, wraplen,
if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
stir->io_buf, wraplen,
- NULL,
msecs_to_jiffies(TRANSMIT_TIMEOUT)
))
+ NULL,
TRANSMIT_TIMEOUT
))
stir->stats.tx_errors++;
}
stir->stats.tx_errors++;
}
@@
-766,8
+760,9
@@
static int stir_transmit_thread(void *arg)
&& netif_device_present(dev)
&& !signal_pending(current))
{
&& netif_device_present(dev)
&& !signal_pending(current))
{
+#ifdef CONFIG_PM
/* if suspending, then power off and wait */
/* if suspending, then power off and wait */
- if (
current->flags & PF_FREEZE
) {
+ if (
unlikely(freezing(current))
) {
if (stir->receiving)
receive_stop(stir);
else
if (stir->receiving)
receive_stop(stir);
else
@@
-775,11
+770,12
@@
static int stir_transmit_thread(void *arg)
write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
- refrigerator(
PF_FREEZE
);
+ refrigerator();
if (change_speed(stir, stir->speed))
break;
}
if (change_speed(stir, stir->speed))
break;
}
+#endif
/* if something to send? */
skb = xchg(&stir->tx_pending, NULL);
/* if something to send? */
skb = xchg(&stir->tx_pending, NULL);
@@
-791,7
+787,7
@@
static int stir_transmit_thread(void *arg)
stir_send(stir, skb);
dev_kfree_skb(skb);
stir_send(stir, skb);
dev_kfree_skb(skb);
- if (
stir->speed != new_speed
) {
+ if (
(new_speed != -1) && (stir->speed != new_speed)
) {
if (fifo_txwait(stir, -1) ||
change_speed(stir, new_speed))
break;
if (fifo_txwait(stir, -1) ||
change_speed(stir, new_speed))
break;
@@
-874,7
+870,7
@@
static void stir_rcv_irq(struct urb *urb, struct pt_regs *regs)
*/
static int stir_net_open(struct net_device *netdev)
{
*/
static int stir_net_open(struct net_device *netdev)
{
- struct stir_cb *stir = netdev
->priv
;
+ struct stir_cb *stir = netdev
_priv(netdev)
;
int err;
char hwname[16];
int err;
char hwname[16];
@@
-927,7
+923,7
@@
static int stir_net_open(struct net_device *netdev)
sprintf(hwname, "usb#%d", stir->usbdev->devnum);
stir->irlap = irlap_open(netdev, &stir->qos, hwname);
if (!stir->irlap) {
sprintf(hwname, "usb#%d", stir->usbdev->devnum);
stir->irlap = irlap_open(netdev, &stir->qos, hwname);
if (!stir->irlap) {
- err("irlap_open failed");
+ err("
stir4200:
irlap_open failed");
goto err_out5;
}
goto err_out5;
}
@@
-936,7
+932,7
@@
static int stir_net_open(struct net_device *netdev)
CLONE_FS|CLONE_FILES);
if (stir->thr_pid < 0) {
err = stir->thr_pid;
CLONE_FS|CLONE_FILES);
if (stir->thr_pid < 0) {
err = stir->thr_pid;
- err("unable to start kernel thread");
+ err("
stir4200:
unable to start kernel thread");
goto err_out6;
}
goto err_out6;
}
@@
-966,7
+962,7
@@
static int stir_net_open(struct net_device *netdev)
*/
static int stir_net_close(struct net_device *netdev)
{
*/
static int stir_net_close(struct net_device *netdev)
{
- struct stir_cb *stir = netdev
->priv
;
+ struct stir_cb *stir = netdev
_priv(netdev)
;
/* Stop transmit processing */
netif_stop_queue(netdev);
/* Stop transmit processing */
netif_stop_queue(netdev);
@@
-977,7
+973,7
@@
static int stir_net_close(struct net_device *netdev)
kfree(stir->fifo_status);
/* Mop up receive urb's */
kfree(stir->fifo_status);
/* Mop up receive urb's */
- usb_
unlink
_urb(stir->rx_urb);
+ usb_
kill
_urb(stir->rx_urb);
kfree(stir->io_buf);
usb_free_urb(stir->rx_urb);
kfree(stir->io_buf);
usb_free_urb(stir->rx_urb);
@@
-995,10
+991,10
@@
static int stir_net_close(struct net_device *netdev)
/*
* IOCTLs : Extra out-of-band network commands...
*/
/*
* IOCTLs : Extra out-of-band network commands...
*/
-static int stir_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+static int stir_net_ioctl(struct net_device *
net
dev, struct ifreq *rq, int cmd)
{
struct if_irda_req *irq = (struct if_irda_req *) rq;
{
struct if_irda_req *irq = (struct if_irda_req *) rq;
- struct stir_cb *stir =
dev->priv
;
+ struct stir_cb *stir =
netdev_priv(netdev)
;
int ret = 0;
switch (cmd) {
int ret = 0;
switch (cmd) {
@@
-1035,9
+1031,9
@@
static int stir_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
/*
* Get device stats (for /proc/net/dev and ifconfig)
*/
-static struct net_device_stats *stir_net_get_stats(struct net_device *dev)
+static struct net_device_stats *stir_net_get_stats(struct net_device *
net
dev)
{
{
- struct stir_cb *stir =
dev->priv
;
+ struct stir_cb *stir =
netdev_priv(netdev)
;
return &stir->stats;
}
return &stir->stats;
}
@@
-1063,20
+1059,20
@@
static int stir_probe(struct usb_interface *intf,
SET_MODULE_OWNER(net);
SET_NETDEV_DEV(net, &intf->dev);
SET_MODULE_OWNER(net);
SET_NETDEV_DEV(net, &intf->dev);
- stir = net
->priv
;
+ stir = net
dev_priv(net)
;
stir->netdev = net;
stir->usbdev = dev;
ret = usb_reset_configuration(dev);
if (ret != 0) {
stir->netdev = net;
stir->usbdev = dev;
ret = usb_reset_configuration(dev);
if (ret != 0) {
- err("usb reset configuration failed");
+ err("
stir4200:
usb reset configuration failed");
goto err_out2;
}
printk(KERN_INFO "SigmaTel STIr4200 IRDA/USB found at address %d, "
"Vendor: %x, Product: %x\n",
goto err_out2;
}
printk(KERN_INFO "SigmaTel STIr4200 IRDA/USB found at address %d, "
"Vendor: %x, Product: %x\n",
- dev->devnum,
dev->descriptor.idVendor
,
-
dev->descriptor.idProduct
);
+ dev->devnum,
le16_to_cpu(dev->descriptor.idVendor)
,
+
le16_to_cpu(dev->descriptor.idProduct)
);
/* Initialize QoS for this device */
irda_init_max_qos_capabilies(&stir->qos);
/* Initialize QoS for this device */
irda_init_max_qos_capabilies(&stir->qos);
@@
-1102,7
+1098,7
@@
static int stir_probe(struct usb_interface *intf,
if (ret != 0)
goto err_out2;
if (ret != 0)
goto err_out2;
-
MESSAGE("IrDA: Registered SigmaTel device %s\n
", net->name);
+
info("IrDA: Registered SigmaTel device %s
", net->name);
usb_set_intfdata(intf, stir);
usb_set_intfdata(intf, stir);
@@
-1130,9
+1126,9
@@
static void stir_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
}
usb_set_intfdata(intf, NULL);
}
-
-/*
Power management
suspend, so power off the transmitter/receiver */
-static int stir_suspend(struct usb_interface *intf,
u32 stat
e)
+#ifdef CONFIG_PM
+/*
USB
suspend, so power off the transmitter/receiver */
+static int stir_suspend(struct usb_interface *intf,
pm_message_t messag
e)
{
struct stir_cb *stir = usb_get_intfdata(intf);
{
struct stir_cb *stir = usb_get_intfdata(intf);
@@
-1150,18
+1146,20
@@
static int stir_resume(struct usb_interface *intf)
/* receiver restarted when send thread wakes up */
return 0;
}
/* receiver restarted when send thread wakes up */
return 0;
}
+#endif
/*
* USB device callbacks
*/
static struct usb_driver irda_driver = {
/*
* USB device callbacks
*/
static struct usb_driver irda_driver = {
- .owner = THIS_MODULE,
.name = "stir4200",
.probe = stir_probe,
.disconnect = stir_disconnect,
.id_table = dongles,
.name = "stir4200",
.probe = stir_probe,
.disconnect = stir_disconnect,
.id_table = dongles,
+#ifdef CONFIG_PM
.suspend = stir_suspend,
.resume = stir_resume,
.suspend = stir_suspend,
.resume = stir_resume,
+#endif
};
/*
};
/*
@@
-1169,11
+1167,7
@@
static struct usb_driver irda_driver = {
*/
static int __init stir_init(void)
{
*/
static int __init stir_init(void)
{
- if (usb_register(&irda_driver) < 0)
- return -1;
-
- MESSAGE("SigmaTel support registered\n");
- return 0;
+ return usb_register(&irda_driver);
}
module_init(stir_init);
}
module_init(stir_init);