diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/completion.h | 45 | ||||
-rw-r--r-- | include/linux/cred.h | 50 | ||||
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | include/linux/skbuff.h | 6 | ||||
-rw-r--r-- | include/linux/usb.h | 2 | ||||
-rw-r--r-- | include/linux/usb/musb.h | 98 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 3 |
7 files changed, 201 insertions, 4 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index d2961b66d53d..57faa60de9bd 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -55,4 +55,49 @@ extern void complete_all(struct completion *); | |||
55 | 55 | ||
56 | #define INIT_COMPLETION(x) ((x).done = 0) | 56 | #define INIT_COMPLETION(x) ((x).done = 0) |
57 | 57 | ||
58 | |||
59 | /** | ||
60 | * try_wait_for_completion - try to decrement a completion without blocking | ||
61 | * @x: completion structure | ||
62 | * | ||
63 | * Returns: 0 if a decrement cannot be done without blocking | ||
64 | * 1 if a decrement succeeded. | ||
65 | * | ||
66 | * If a completion is being used as a counting completion, | ||
67 | * attempt to decrement the counter without blocking. This | ||
68 | * enables us to avoid waiting if the resource the completion | ||
69 | * is protecting is not available. | ||
70 | */ | ||
71 | static inline bool try_wait_for_completion(struct completion *x) | ||
72 | { | ||
73 | int ret = 1; | ||
74 | |||
75 | spin_lock_irq(&x->wait.lock); | ||
76 | if (!x->done) | ||
77 | ret = 0; | ||
78 | else | ||
79 | x->done--; | ||
80 | spin_unlock_irq(&x->wait.lock); | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * completion_done - Test to see if a completion has any waiters | ||
86 | * @x: completion structure | ||
87 | * | ||
88 | * Returns: 0 if there are waiters (wait_for_completion() in progress) | ||
89 | * 1 if there are no waiters. | ||
90 | * | ||
91 | */ | ||
92 | static inline bool completion_done(struct completion *x) | ||
93 | { | ||
94 | int ret = 1; | ||
95 | |||
96 | spin_lock_irq(&x->wait.lock); | ||
97 | if (!x->done) | ||
98 | ret = 0; | ||
99 | spin_unlock_irq(&x->wait.lock); | ||
100 | return ret; | ||
101 | } | ||
102 | |||
58 | #endif | 103 | #endif |
diff --git a/include/linux/cred.h b/include/linux/cred.h new file mode 100644 index 000000000000..b69222cc1fd2 --- /dev/null +++ b/include/linux/cred.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* Credentials management | ||
2 | * | ||
3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_CRED_H | ||
13 | #define _LINUX_CRED_H | ||
14 | |||
15 | #define get_current_user() (get_uid(current->user)) | ||
16 | |||
17 | #define task_uid(task) ((task)->uid) | ||
18 | #define task_gid(task) ((task)->gid) | ||
19 | #define task_euid(task) ((task)->euid) | ||
20 | #define task_egid(task) ((task)->egid) | ||
21 | |||
22 | #define current_uid() (current->uid) | ||
23 | #define current_gid() (current->gid) | ||
24 | #define current_euid() (current->euid) | ||
25 | #define current_egid() (current->egid) | ||
26 | #define current_suid() (current->suid) | ||
27 | #define current_sgid() (current->sgid) | ||
28 | #define current_fsuid() (current->fsuid) | ||
29 | #define current_fsgid() (current->fsgid) | ||
30 | #define current_cap() (current->cap_effective) | ||
31 | |||
32 | #define current_uid_gid(_uid, _gid) \ | ||
33 | do { \ | ||
34 | *(_uid) = current->uid; \ | ||
35 | *(_gid) = current->gid; \ | ||
36 | } while(0) | ||
37 | |||
38 | #define current_euid_egid(_uid, _gid) \ | ||
39 | do { \ | ||
40 | *(_uid) = current->euid; \ | ||
41 | *(_gid) = current->egid; \ | ||
42 | } while(0) | ||
43 | |||
44 | #define current_fsuid_fsgid(_uid, _gid) \ | ||
45 | do { \ | ||
46 | *(_uid) = current->fsuid; \ | ||
47 | *(_gid) = current->fsgid; \ | ||
48 | } while(0) | ||
49 | |||
50 | #endif /* _LINUX_CRED_H */ | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5850bfb968a8..cfb0d87b99fc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -87,6 +87,7 @@ struct sched_param { | |||
87 | #include <linux/task_io_accounting.h> | 87 | #include <linux/task_io_accounting.h> |
88 | #include <linux/kobject.h> | 88 | #include <linux/kobject.h> |
89 | #include <linux/latencytop.h> | 89 | #include <linux/latencytop.h> |
90 | #include <linux/cred.h> | ||
90 | 91 | ||
91 | #include <asm/processor.h> | 92 | #include <asm/processor.h> |
92 | 93 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index cfcc45b3bef0..358661c9990e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -901,7 +901,7 @@ extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); | |||
901 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) | 901 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) |
902 | { | 902 | { |
903 | if (len > skb_headlen(skb) && | 903 | if (len > skb_headlen(skb) && |
904 | !__pskb_pull_tail(skb, len-skb_headlen(skb))) | 904 | !__pskb_pull_tail(skb, len - skb_headlen(skb))) |
905 | return NULL; | 905 | return NULL; |
906 | skb->len -= len; | 906 | skb->len -= len; |
907 | return skb->data += len; | 907 | return skb->data += len; |
@@ -918,7 +918,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) | |||
918 | return 1; | 918 | return 1; |
919 | if (unlikely(len > skb->len)) | 919 | if (unlikely(len > skb->len)) |
920 | return 0; | 920 | return 0; |
921 | return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL; | 921 | return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; |
922 | } | 922 | } |
923 | 923 | ||
924 | /** | 924 | /** |
@@ -1321,7 +1321,7 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len) | |||
1321 | unsigned int size = skb->len; | 1321 | unsigned int size = skb->len; |
1322 | if (likely(size >= len)) | 1322 | if (likely(size >= len)) |
1323 | return 0; | 1323 | return 0; |
1324 | return skb_pad(skb, len-size); | 1324 | return skb_pad(skb, len - size); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | static inline int skb_add_data(struct sk_buff *skb, | 1327 | static inline int skb_add_data(struct sk_buff *skb, |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 5811c5da69f9..0924cd9c30f6 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -110,6 +110,8 @@ enum usb_interface_condition { | |||
110 | * @sysfs_files_created: sysfs attributes exist | 110 | * @sysfs_files_created: sysfs attributes exist |
111 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup | 111 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup |
112 | * capability during autosuspend. | 112 | * capability during autosuspend. |
113 | * @needs_binding: flag set when the driver should be re-probed or unbound | ||
114 | * following a reset or suspend operation it doesn't support. | ||
113 | * @dev: driver model's view of this device | 115 | * @dev: driver model's view of this device |
114 | * @usb_dev: if an interface is bound to the USB major, this will point | 116 | * @usb_dev: if an interface is bound to the USB major, this will point |
115 | * to the sysfs representation for that device. | 117 | * to the sysfs representation for that device. |
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h new file mode 100644 index 000000000000..630962c04ca4 --- /dev/null +++ b/include/linux/usb/musb.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * This is used to for host and peripheral modes of the driver for | ||
3 | * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC. | ||
4 | * | ||
5 | * Board initialization should put one of these into dev->platform_data, | ||
6 | * probably on some platform_device named "musb_hdrc". It encapsulates | ||
7 | * key configuration differences between boards. | ||
8 | */ | ||
9 | |||
10 | /* The USB role is defined by the connector used on the board, so long as | ||
11 | * standards are being followed. (Developer boards sometimes won't.) | ||
12 | */ | ||
13 | enum musb_mode { | ||
14 | MUSB_UNDEFINED = 0, | ||
15 | MUSB_HOST, /* A or Mini-A connector */ | ||
16 | MUSB_PERIPHERAL, /* B or Mini-B connector */ | ||
17 | MUSB_OTG /* Mini-AB connector */ | ||
18 | }; | ||
19 | |||
20 | struct clk; | ||
21 | |||
22 | struct musb_hdrc_eps_bits { | ||
23 | const char name[16]; | ||
24 | u8 bits; | ||
25 | }; | ||
26 | |||
27 | struct musb_hdrc_config { | ||
28 | /* MUSB configuration-specific details */ | ||
29 | unsigned multipoint:1; /* multipoint device */ | ||
30 | unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ | ||
31 | unsigned soft_con:1; /* soft connect required */ | ||
32 | unsigned utm_16:1; /* utm data witdh is 16 bits */ | ||
33 | unsigned big_endian:1; /* true if CPU uses big-endian */ | ||
34 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ | ||
35 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ | ||
36 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ | ||
37 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ | ||
38 | unsigned dma:1; /* supports DMA */ | ||
39 | unsigned vendor_req:1; /* vendor registers required */ | ||
40 | |||
41 | u8 num_eps; /* number of endpoints _with_ ep0 */ | ||
42 | u8 dma_channels; /* number of dma channels */ | ||
43 | u8 dyn_fifo_size; /* dynamic size in bytes */ | ||
44 | u8 vendor_ctrl; /* vendor control reg width */ | ||
45 | u8 vendor_stat; /* vendor status reg witdh */ | ||
46 | u8 dma_req_chan; /* bitmask for required dma channels */ | ||
47 | u8 ram_bits; /* ram address size */ | ||
48 | |||
49 | struct musb_hdrc_eps_bits *eps_bits; | ||
50 | }; | ||
51 | |||
52 | struct musb_hdrc_platform_data { | ||
53 | /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ | ||
54 | u8 mode; | ||
55 | |||
56 | /* for clk_get() */ | ||
57 | const char *clock; | ||
58 | |||
59 | /* (HOST or OTG) switch VBUS on/off */ | ||
60 | int (*set_vbus)(struct device *dev, int is_on); | ||
61 | |||
62 | /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */ | ||
63 | u8 power; | ||
64 | |||
65 | /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */ | ||
66 | u8 min_power; | ||
67 | |||
68 | /* (HOST or OTG) msec/2 after VBUS on till power good */ | ||
69 | u8 potpgt; | ||
70 | |||
71 | /* Power the device on or off */ | ||
72 | int (*set_power)(int state); | ||
73 | |||
74 | /* Turn device clock on or off */ | ||
75 | int (*set_clock)(struct clk *clock, int is_on); | ||
76 | |||
77 | /* MUSB configuration-specific details */ | ||
78 | struct musb_hdrc_config *config; | ||
79 | }; | ||
80 | |||
81 | |||
82 | /* TUSB 6010 support */ | ||
83 | |||
84 | #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */ | ||
85 | #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */ | ||
86 | #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */ | ||
87 | |||
88 | #ifdef CONFIG_ARCH_OMAP2 | ||
89 | |||
90 | extern int __init tusb6010_setup_interface( | ||
91 | struct musb_hdrc_platform_data *data, | ||
92 | unsigned ps_refclk, unsigned waitpin, | ||
93 | unsigned async_cs, unsigned sync_cs, | ||
94 | unsigned irq, unsigned dmachan); | ||
95 | |||
96 | extern int tusb6010_platform_retime(unsigned is_refclk); | ||
97 | |||
98 | #endif /* OMAP2 */ | ||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 09a3e6a7518f..655341d0f534 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | 18 | ||
19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
20 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
21 | #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */ | ||
21 | 22 | ||
22 | /* The maximum number of ports one device can grab at once */ | 23 | /* The maximum number of ports one device can grab at once */ |
23 | #define MAX_NUM_PORTS 8 | 24 | #define MAX_NUM_PORTS 8 |