Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtl8712: intf_priv: Replace semaphore lock with completion

The semaphore 'lock' in 'intf_priv' is used as completion,
so convert it to a struct completion type.

Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Binoy Jayan and committed by
Greg Kroah-Hartman
7c2bb7af 204a8ac1

+4 -4
+1 -1
drivers/staging/rtl8712/osdep_intf.h
··· 36 36 /* when in USB, IO is through interrupt in/out endpoints */ 37 37 struct usb_device *udev; 38 38 struct urb *piorw_urb; 39 - struct semaphore io_retevt; 39 + struct completion io_retevt_comp; 40 40 }; 41 41 42 42 int r871x_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+3 -3
drivers/staging/rtl8712/usb_ops_linux.c
··· 50 50 pintfpriv->piorw_urb = usb_alloc_urb(0, GFP_ATOMIC); 51 51 if (!pintfpriv->piorw_urb) 52 52 return _FAIL; 53 - sema_init(&(pintfpriv->io_retevt), 0); 53 + init_completion(&pintfpriv->io_retevt_comp); 54 54 return _SUCCESS; 55 55 } 56 56 ··· 163 163 else 164 164 padapter->bSurpriseRemoved = true; 165 165 } 166 - up(&pintfpriv->io_retevt); 166 + complete(&pintfpriv->io_retevt_comp); 167 167 } 168 168 169 169 void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) ··· 187 187 wmem, cnt, usb_write_mem_complete, 188 188 pio_queue); 189 189 usb_submit_urb(piorw_urb, GFP_ATOMIC); 190 - _down_sema(&pintfpriv->io_retevt); 190 + wait_for_completion_interruptible(&pintfpriv->io_retevt_comp); 191 191 } 192 192 193 193 static void r8712_usb_read_port_complete(struct urb *purb)