Commit e4d131d3 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab

[media] rtl2832_sdr: cleanup some set_bit() calls

This code works fine but static checkers complain.  The test_bit()
function takes the bit number and not a mask.  Then the other issue is
that we were using USB_STATE_URB_BUF which is BIT(0) instead of URB_BUF.
Also we were open coding that instead of using the test/clear/set_bit()
functions.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 85756a06
...@@ -112,8 +112,8 @@ struct rtl2832_sdr_frame_buf { ...@@ -112,8 +112,8 @@ struct rtl2832_sdr_frame_buf {
}; };
struct rtl2832_sdr_dev { struct rtl2832_sdr_dev {
#define POWER_ON (1 << 1) #define POWER_ON 0 /* BIT(0) */
#define URB_BUF (1 << 2) #define URB_BUF 1 /* BIT(1) */
unsigned long flags; unsigned long flags;
struct platform_device *pdev; struct platform_device *pdev;
...@@ -356,7 +356,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev) ...@@ -356,7 +356,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev)
{ {
struct platform_device *pdev = dev->pdev; struct platform_device *pdev = dev->pdev;
if (dev->flags & USB_STATE_URB_BUF) { if (test_bit(URB_BUF, &dev->flags)) {
while (dev->buf_num) { while (dev->buf_num) {
dev->buf_num--; dev->buf_num--;
dev_dbg(&pdev->dev, "free buf=%d\n", dev->buf_num); dev_dbg(&pdev->dev, "free buf=%d\n", dev->buf_num);
...@@ -365,7 +365,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev) ...@@ -365,7 +365,7 @@ static int rtl2832_sdr_free_stream_bufs(struct rtl2832_sdr_dev *dev)
dev->dma_addr[dev->buf_num]); dev->dma_addr[dev->buf_num]);
} }
} }
dev->flags &= ~USB_STATE_URB_BUF; clear_bit(URB_BUF, &dev->flags);
return 0; return 0;
} }
...@@ -394,7 +394,7 @@ static int rtl2832_sdr_alloc_stream_bufs(struct rtl2832_sdr_dev *dev) ...@@ -394,7 +394,7 @@ static int rtl2832_sdr_alloc_stream_bufs(struct rtl2832_sdr_dev *dev)
dev_dbg(&pdev->dev, "alloc buf=%d %p (dma %llu)\n", dev_dbg(&pdev->dev, "alloc buf=%d %p (dma %llu)\n",
dev->buf_num, dev->buf_list[dev->buf_num], dev->buf_num, dev->buf_list[dev->buf_num],
(long long)dev->dma_addr[dev->buf_num]); (long long)dev->dma_addr[dev->buf_num]);
dev->flags |= USB_STATE_URB_BUF; set_bit(URB_BUF, &dev->flags);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment