diff options
| author | Daniel Mack <zonque@gmail.com> | 2014-08-27 13:09:05 -0400 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2014-09-02 10:17:06 -0400 |
| commit | 254b3bf68b65ac8f82da1c7e0c1a2bb17012aa7d (patch) | |
| tree | bdf33e966254ca8ec9870985ca4242f6ae672388 /drivers/usb/gadget/function | |
| parent | a8147dabe56f7e7a4975e60abb613f7e62277577 (diff) | |
usb: gadget: f_uac2: introduce agdev_to_uac2_opts
Add a simple container_of() wrapper to get a struct f_uac2_opts from a
struct struct audio_dev. Use it in two places where it is currently
open-coded.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function')
| -rw-r--r-- | drivers/usb/gadget/function/f_uac2.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index efe8add29670..9c8831d74f5b 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
| @@ -140,6 +140,12 @@ struct snd_uac2_chip *pdev_to_uac2(struct platform_device *p) | |||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static inline | 142 | static inline |
| 143 | struct f_uac2_opts *agdev_to_uac2_opts(struct audio_dev *agdev) | ||
| 144 | { | ||
| 145 | return container_of(agdev->func.fi, struct f_uac2_opts, func_inst); | ||
| 146 | } | ||
| 147 | |||
| 148 | static inline | ||
| 143 | uint num_channels(uint chanmask) | 149 | uint num_channels(uint chanmask) |
| 144 | { | 150 | { |
| 145 | uint num = 0; | 151 | uint num = 0; |
| @@ -1168,7 +1174,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr) | |||
| 1168 | int value = -EOPNOTSUPP; | 1174 | int value = -EOPNOTSUPP; |
| 1169 | int p_srate, c_srate; | 1175 | int p_srate, c_srate; |
| 1170 | 1176 | ||
| 1171 | opts = container_of(agdev->func.fi, struct f_uac2_opts, func_inst); | 1177 | opts = agdev_to_uac2_opts(agdev); |
| 1172 | p_srate = opts->p_srate; | 1178 | p_srate = opts->p_srate; |
| 1173 | c_srate = opts->c_srate; | 1179 | c_srate = opts->c_srate; |
| 1174 | 1180 | ||
| @@ -1210,7 +1216,7 @@ in_rq_range(struct usb_function *fn, const struct usb_ctrlrequest *cr) | |||
| 1210 | int value = -EOPNOTSUPP; | 1216 | int value = -EOPNOTSUPP; |
| 1211 | int p_srate, c_srate; | 1217 | int p_srate, c_srate; |
| 1212 | 1218 | ||
| 1213 | opts = container_of(agdev->func.fi, struct f_uac2_opts, func_inst); | 1219 | opts = agdev_to_uac2_opts(agdev); |
| 1214 | p_srate = opts->p_srate; | 1220 | p_srate = opts->p_srate; |
| 1215 | c_srate = opts->c_srate; | 1221 | c_srate = opts->c_srate; |
| 1216 | 1222 | ||
