summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_uac2.c
diff options
context:
space:
mode:
authorJassi Brar <jaswinder.singh@linaro.org>2013-05-30 18:23:33 +0530
committerFelipe Balbi <balbi@ti.com>2013-06-10 17:10:23 +0300
commiteb127cb519d73c0d0e8089dcbde8c94dc1fc7e20 (patch)
tree8a8d8ffd16f23f2e636e0b122c72c02b4bb58979 /drivers/usb/gadget/f_uac2.c
parentf37d49ad6e3d351fcf3cd042953ff273b6cd47e0 (diff)
downloadop-kernel-dev-eb127cb519d73c0d0e8089dcbde8c94dc1fc7e20.zip
op-kernel-dev-eb127cb519d73c0d0e8089dcbde8c94dc1fc7e20.tar.gz
USB: gadget: f_uac2: Fix broken prm to uac2 mapping
prm_to_uac2() is broken because it tests against pointer it itself mapped onto, which will never be different. Fix the mapping by adding pointer to parent chip in each rtd param and removing the prm_to_uac2(). Reported-by: Julien Rouviere <jrouviere@qualistream.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_uac2.c')
-rw-r--r--drivers/usb/gadget/f_uac2.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
index 03c1fb6..2f23566 100644
--- a/drivers/usb/gadget/f_uac2.c
+++ b/drivers/usb/gadget/f_uac2.c
@@ -90,6 +90,7 @@ struct uac2_req {
};
struct uac2_rtd_params {
+ struct snd_uac2_chip *uac2; /* parent chip */
bool ep_enabled; /* if the ep is enabled */
/* Size of the ring buffer */
size_t dma_bytes;
@@ -169,18 +170,6 @@ struct snd_uac2_chip *pdev_to_uac2(struct platform_device *p)
}
static inline
-struct snd_uac2_chip *prm_to_uac2(struct uac2_rtd_params *r)
-{
- struct snd_uac2_chip *uac2 = container_of(r,
- struct snd_uac2_chip, c_prm);
-
- if (&uac2->c_prm != r)
- uac2 = container_of(r, struct snd_uac2_chip, p_prm);
-
- return uac2;
-}
-
-static inline
uint num_channels(uint chanmask)
{
uint num = 0;
@@ -204,7 +193,7 @@ agdev_iso_complete(struct usb_ep *ep, struct usb_request *req)
struct uac2_req *ur = req->context;
struct snd_pcm_substream *substream;
struct uac2_rtd_params *prm = ur->pp;
- struct snd_uac2_chip *uac2 = prm_to_uac2(prm);
+ struct snd_uac2_chip *uac2 = prm->uac2;
/* i/f shutting down */
if (!prm->ep_enabled)
@@ -894,7 +883,7 @@ struct cntrl_range_lay3 {
static inline void
free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep)
{
- struct snd_uac2_chip *uac2 = prm_to_uac2(prm);
+ struct snd_uac2_chip *uac2 = prm->uac2;
int i;
prm->ep_enabled = false;
@@ -970,6 +959,9 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
}
agdev->in_ep->driver_data = agdev;
+ uac2->p_prm.uac2 = uac2;
+ uac2->c_prm.uac2 = uac2;
+
hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
hs_epout_desc.wMaxPacketSize = fs_epout_desc.wMaxPacketSize;
hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
OpenPOWER on IntegriCloud