Skip to contentSkip to conversation

IDT77252: use abs() from kernel.h where appropriate

PATCH In review [email protected] 3 participants 6 messages Aug 30, 2007 1 message not in the archive Kernel janitors

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/3 IDT77252: use abs() from kernel.h where appropriate

From: Andre Haupt <[email protected]>

---
Index: linus/drivers/atm/idt77252.c
=================================--- linus.orig/drivers/atm/idt77252.c 2007-08-30 11:33:22.000000000 +0200
+++ linus/drivers/atm/idt77252.c 2007-08-30 11:37:00.000000000 +0200
@@ -2092,7 +2092,7 @@ idt77252_rate_logindex(struct idt77252_d
{
u16 afp;

- afp = idt77252_int_to_atmfp(pcr < 0 ? -pcr : pcr);
+ afp = idt77252_int_to_atmfp(abs(pcr));
if (pcr < 0)
return rate_to_log[(afp >> 5) & 0x1ff];
return rate_to_log[((afp >> 5) + 1) & 0x1ff];
@@ -2149,7 +2149,7 @@ idt77252_init_est(struct vc_map *vc, int
est = kzalloc(sizeof(struct rate_estimator), GFP_KERNEL); if (!est)
return NULL;
- est->maxcps = pcr < 0 ? -pcr : pcr;
+ est->maxcps = abs(pcr);
est->cps = est->maxcps;
est->avcps = est->cps << 5;

--

#2 lore raw

PATCH 2/3 CIFS SMB: use abs() from kernel.h where appropriate

In reply to a message not in the archive

From: Andre Haupt <[email protected]>

---
Index: linus/fs/cifs/cifssmb.c
=================================--- linus.orig/fs/cifs/cifssmb.c 2007-08-30 11:43:20.000000000 +0200
+++ linus/fs/cifs/cifssmb.c 2007-08-30 11:44:58.000000000 +0200
@@ -513,7 +513,7 @@ CIFSSMBNegotiate(unsigned int xid, struc
(int)ts.tv_sec, (int)utc.tv_sec, (int)(utc.tv_sec - ts.tv_sec)));
val = (int)(utc.tv_sec - ts.tv_sec);
- seconds = val < 0 ? -val : val;
+ seconds = abs(val);
result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ; remain = seconds % MIN_TZ_ADJ;
if (remain >= (MIN_TZ_ADJ / 2))

--

#3 lore raw

PATCH 3/3 VIDC20: use abs() from kernel.h instead of own definition

In reply to a message not in the archive

From: Andre Haupt <[email protected]>

---
Index: linus/sound/oss/vidc.c
=================================--- linus.orig/sound/oss/vidc.c 2007-08-30 11:57:13.000000000 +0200
+++ linus/sound/oss/vidc.c 2007-08-30 11:57:53.000000000 +0200
@@ -185,8 +185,6 @@ static unsigned int vidc_audio_set_forma
return vidc_audio_format;
}

-#define my_abs(i) ((i)<0 ? -(i) : (i))
-
static int vidc_audio_set_speed(int dev, int rate) {
if (rate) {
@@ -214,8 +212,8 @@ static int vidc_audio_set_speed(int dev,
rate_ext = VIDC_SOUND_CLOCK_EXT / hwrate_ext;

/* Chose between external and internal clock */
- diff_int = my_abs(rate_ext-rate);
- diff_ext = my_abs(rate_int-rate);
+ diff_int = abs(rate_ext-rate);
+ diff_ext = abs(rate_int-rate);
if (diff_ext < diff_int) {
/*printk("VIDC: external %d %d %d\n", rate, rate_ext, hwrate_ext);*/ hwrate=hwrate_ext;

--

#4 lore raw

Re: [KJ][patch 3/3] VIDC20: use abs() from kernel.h instead of own definition

Review

Quoted 4 lines · On Thu, Aug 30, 2007 at 12:40:38PM +0200, [email protected] wrote:
(quoted diff) +2 -2
-		diff_int = my_abs(rate_ext-rate);
-		diff_ext = my_abs(rate_int-rate);
+		diff_int = abs(rate_ext-rate);
+		diff_ext = abs(rate_int-rate);

Nothing to do with the patch, but is this really correct? Surely it should be diff_ext = abs(rate_ext-rate) ?

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#5 lore raw

Re: [KJ][patch 3/3] VIDC20: use abs() from kernel.h instead of own definition

Quoted 8 lines · Matthew Wilcox

Review

Quoted 4 lines · On Thu, Aug 30, 2007 at 12:40:38PM +0200, [email protected] wrote:
(quoted diff) +2 -2
-		diff_int = my_abs(rate_ext-rate);
-		diff_ext = my_abs(rate_int-rate);
+		diff_int = abs(rate_ext-rate);
+		diff_ext = abs(rate_int-rate);

Nothing to do with the patch, but is this really correct? Surely it should be diff_ext = abs(rate_ext-rate) ?

hmmh, not sure about this ...

Russell?

regards,

Andre

#6 lore raw

Re: [KJ][patch 3/3] VIDC20: use abs() from kernel.h instead of own definition

Quoted 11 lines · Andre Haupt
Quoted 8 lines · Matthew Wilcox

Review

Quoted 4 lines · On Thu, Aug 30, 2007 at 12:40:38PM +0200, [email protected] wrote:
(quoted diff) +2 -2
-		diff_int = my_abs(rate_ext-rate);
-		diff_ext = my_abs(rate_int-rate);
+		diff_int = abs(rate_ext-rate);
+		diff_ext = abs(rate_int-rate);

Nothing to do with the patch, but is this really correct? Surely it should be diff_ext = abs(rate_ext-rate) ?

hmmh, not sure about this ...

No idea. The support for external clocking came from someone else (I was never able to work it out myself).

I can only assume that the code as it stands does work. So let's remain bug-compatible until there's a proven problem.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of: