Skip to contentSkip to conversation

iio:adf4350: Fix typo

PATCH In review Lars-Peter Clausen 2 participants 2 messages Dec 6, 2012 – Dec 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:adf4350: Fix typo

From: Michael Hennerich <[email protected]>

There is a typo in the adf4350 driver turning a shift into a compare. This patch fixes it.

---
 drivers/iio/frequency/adf4350.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4350.c +1 -1
index e35bb8f..c7de8b5 100644
@@ -173,7 +173,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
 			} while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
 		} while (r_cnt == 0);
 
-		tmp = freq * (u64)st->r1_mod + (st->fpfd > 1);
+		tmp = freq * (u64)st->r1_mod + (st->fpfd >> 1);
 		do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
 		st->r0_fract = do_div(tmp, st->r1_mod);
 		st->r0_int = tmp;
Signature · 1 line
1.8.0
maintainer
#1 lore raw
Quoted 7 lines · Lars-Peter Clausen

From: Michael Hennerich <[email protected]>

There is a typo in the adf4350 driver turning a shift into a compare. This patch fixes it.

added to fixes-togreg branch of iio.git

Quoted 18 lines
---
 drivers/iio/frequency/adf4350.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4350.c +1 -1
index e35bb8f..c7de8b5 100644
@@ -173,7 +173,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
 			} while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
 		} while (r_cnt == 0);
 
-		tmp = freq * (u64)st->r1_mod + (st->fpfd > 1);
+		tmp = freq * (u64)st->r1_mod + (st->fpfd >> 1);
 		do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
 		st->r0_fract = do_div(tmp, st->r1_mod);
 		st->r0_int = tmp;