Skip to content

Commit

Permalink
staging: dgap: Use unsigned for loop index
Browse files Browse the repository at this point in the history
The following semantic patch is used to do this

@r exists@ // find anything that might decrement the variable
identifier i;
expression E;
position p;
@@

  int i@p;
  ...
(
  &i
|
  i--
|
  --i
|
  i-=E
|
  i+=E
)

@x disable decl_init@
identifier r.i;
expression E;
position p1 != r.p;
@@

(
  volatile int i = 0;
|
  volatile int i;
|
+ unsigned
  int i@p1 = 0;
|
+ unsigned
  int i@p1;
)
  <... when != i = E
(
  i = 0
|
  i = 1
)
  ...>

Signed-off-by: Tapasweni Pathak <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tapaswenipathak authored and gregkh committed Oct 28, 2014
1 parent 43f61da commit ac2f46c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions drivers/staging/dgap/dgap.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static void dgap_remove_one(struct pci_dev *dev)
*/
static void dgap_cleanup_module(void)
{
int i;
unsigned int i;
ulong lock_flags;

spin_lock_irqsave(&dgap_poll_lock, lock_flags);
Expand Down Expand Up @@ -691,7 +691,7 @@ static void dgap_cleanup_module(void)
*/
static void dgap_cleanup_board(struct board_t *brd)
{
int i;
unsigned int i;

if (!brd || brd->magic != DGAP_BOARD_MAGIC)
return;
Expand Down Expand Up @@ -1063,7 +1063,7 @@ static void dgap_unmap(struct board_t *brd)

static void dgap_poll_handler(ulong dummy)
{
int i;
unsigned int i;
struct board_t *brd;
unsigned long lock_flags;
ulong new_time;
Expand Down Expand Up @@ -1196,7 +1196,7 @@ static irqreturn_t dgap_intr(int irq, void *voidbrd)
*/
static void dgap_init_globals(void)
{
int i;
unsigned int i;

for (i = 0; i < MAXBOARDS; i++)
dgap_board[i] = NULL;
Expand Down Expand Up @@ -1515,7 +1515,7 @@ static void dgap_tty_free(struct board_t *brd)
static void dgap_cleanup_tty(struct board_t *brd)
{
struct device *dev;
int i;
unsigned int i;

dgap_boards_by_major[brd->serial_driver->major] = NULL;
brd->dgap_serial_major = 0;
Expand Down Expand Up @@ -4121,7 +4121,7 @@ static void dgap_do_bios_load(struct board_t *brd, const u8 *ubios, int len)
{
u8 __iomem *addr;
uint offset;
int i;
unsigned int i;

if (!brd || (brd->magic != DGAP_BOARD_MAGIC) || !brd->re_map_membase)
return;
Expand Down Expand Up @@ -4217,7 +4217,7 @@ static void dgap_do_fep_load(struct board_t *brd, const u8 *ufep, int len)
u8 string[100];
u8 __iomem *config;
u8 *xconfig;
int i = 0;
unsigned int i = 0;

xconfig = dgap_create_config_string(brd, string);

Expand Down Expand Up @@ -4293,7 +4293,7 @@ static void dgap_do_reset_board(struct board_t *brd)
u8 check;
u32 check1;
u32 check2;
int i;
unsigned int i;

if (!brd || (brd->magic != DGAP_BOARD_MAGIC) ||
!brd->re_map_membase || !brd->re_map_port)
Expand Down Expand Up @@ -5630,7 +5630,7 @@ static ssize_t dgap_ports_state_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5651,7 +5651,7 @@ static ssize_t dgap_ports_baud_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5672,7 +5672,7 @@ static ssize_t dgap_ports_msignals_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand Down Expand Up @@ -5709,7 +5709,7 @@ static ssize_t dgap_ports_iflag_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5729,7 +5729,7 @@ static ssize_t dgap_ports_cflag_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5749,7 +5749,7 @@ static ssize_t dgap_ports_oflag_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5769,7 +5769,7 @@ static ssize_t dgap_ports_lflag_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5789,7 +5789,7 @@ static ssize_t dgap_ports_digi_flag_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5809,7 +5809,7 @@ static ssize_t dgap_ports_rxcount_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand All @@ -5829,7 +5829,7 @@ static ssize_t dgap_ports_txcount_show(struct device *p,
{
struct board_t *bd;
int count = 0;
int i;
unsigned int i;

bd = dgap_verify_board(p);
if (!bd)
Expand Down

0 comments on commit ac2f46c

Please sign in to comment.