linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix RTC-CMOS message
@ 2009-04-02 16:52 Krzysztof Halasa
  2009-04-02 16:57 ` [PATCH] fix RTC-CMOS message, now with SOB Krzysztof Halasa
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Halasa @ 2009-04-02 16:52 UTC (permalink / raw)
  To: David Brownell; +Cc: lkml

With no IRQ available/defined, RTC-CMOS driver prints something like:
	rtc0: alarms up to one no, y3k, 114 bytes nvram
                              ^^^^
I guess the following is a bit easier to understand:
	rtc0: no alarms, y3k, 114 bytes nvram

--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -794,17 +794,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
 		goto cleanup2;
 	}
 
-	pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
-			cmos_rtc.rtc->dev.bus_id,
-			is_valid_irq(rtc_irq)
-				?  (cmos_rtc.mon_alrm
-					? "year"
-					: (cmos_rtc.day_alrm
-						? "month" : "day"))
-				: "no",
-			cmos_rtc.century ? ", y3k" : "",
-			nvram.size,
-			is_hpet_enabled() ? ", hpet irqs" : "");
+	pr_info("%s: %s%s, %zd bytes nvram%s\n",
+		cmos_rtc.rtc->dev.bus_id,
+		!is_valid_irq(rtc_irq) ? "no alarms" :
+		cmos_rtc.mon_alrm ? "alarms up to one year" :
+		cmos_rtc.day_alrm ? "alarms up to one month" :
+		"alarms up to one day",
+		cmos_rtc.century ? ", y3k" : "",
+		nvram.size,
+		is_hpet_enabled() ? ", hpet irqs" : "");
 
 	return 0;
 
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, now with SOB
  2009-04-02 16:52 [PATCH] fix RTC-CMOS message Krzysztof Halasa
@ 2009-04-02 16:57 ` Krzysztof Halasa
  2009-04-04 18:02   ` David Brownell
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Halasa @ 2009-04-02 16:57 UTC (permalink / raw)
  To: David Brownell; +Cc: lkml

With no IRQ available/defined, RTC-CMOS driver prints something like:
	rtc0: alarms up to one no, y3k, 114 bytes nvram
                              ^^^^
I guess the following is a bit easier to understand:
	rtc0: no alarms, y3k, 114 bytes nvram

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -794,17 +794,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
 		goto cleanup2;
 	}
 
-	pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
-			cmos_rtc.rtc->dev.bus_id,
-			is_valid_irq(rtc_irq)
-				?  (cmos_rtc.mon_alrm
-					? "year"
-					: (cmos_rtc.day_alrm
-						? "month" : "day"))
-				: "no",
-			cmos_rtc.century ? ", y3k" : "",
-			nvram.size,
-			is_hpet_enabled() ? ", hpet irqs" : "");
+	pr_info("%s: %s%s, %zd bytes nvram%s\n",
+		cmos_rtc.rtc->dev.bus_id,
+		!is_valid_irq(rtc_irq) ? "no alarms" :
+		cmos_rtc.mon_alrm ? "alarms up to one year" :
+		cmos_rtc.day_alrm ? "alarms up to one month" :
+		"alarms up to one day",
+		cmos_rtc.century ? ", y3k" : "",
+		nvram.size,
+		is_hpet_enabled() ? ", hpet irqs" : "");
 
 	return 0;
 
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, now with SOB
  2009-04-02 16:57 ` [PATCH] fix RTC-CMOS message, now with SOB Krzysztof Halasa
@ 2009-04-04 18:02   ` David Brownell
  2009-04-04 19:32     ` Krzysztof Halasa
  0 siblings, 1 reply; 7+ messages in thread
From: David Brownell @ 2009-04-04 18:02 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: lkml

On Thursday 02 April 2009, Krzysztof Halasa wrote:
> +               !is_valid_irq(rtc_irq) ? "no alarms" :
> +               cmos_rtc.mon_alrm ? "alarms up to one year" :
> +               cmos_rtc.day_alrm ? "alarms up to one month" :
> +               "alarms up to one day",

Could you reformat that so it looks more like the compound-IF
statement it really is?  That is, display the nesting structure.
And not use negative logic for that first test.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, now with SOB
  2009-04-04 18:02   ` David Brownell
@ 2009-04-04 19:32     ` Krzysztof Halasa
  2009-04-09 20:15       ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Halasa @ 2009-04-04 19:32 UTC (permalink / raw)
  To: David Brownell; +Cc: lkml

David Brownell <david-b@pacbell.net> writes:

>> +               !is_valid_irq(rtc_irq) ? "no alarms" :
>> +               cmos_rtc.mon_alrm ? "alarms up to one year" :
>> +               cmos_rtc.day_alrm ? "alarms up to one month" :
>> +               "alarms up to one day",
>
> Could you reformat that so it looks more like the compound-IF
> statement it really is?  That is, display the nesting structure.

You mean something like

>> +               !is_valid_irq(rtc_irq) ? "no alarms" :
>> +                       cmos_rtc.mon_alrm ? "alarms up to one year" :
>> +                       cmos_rtc.day_alrm ? "alarms up to one month" :
>> +                       "alarms up to one day",

Not this certainly?

>> +               !is_valid_irq(rtc_irq) ? "no alarms" :
>> +                       cmos_rtc.mon_alrm ? "alarms up to one year" :
>> +                               cmos_rtc.day_alrm ? "alarms up to one month" :
>> +                                       "alarms up to one day",

> And not use negative logic for that first test.

I think it's worse WRT readability:

+		is_valid_irq(rtc_irq) ?
+		        (cmos_rtc.mon_alrm ? "alarms up to one year" :
+		                cmos_rtc.day_alrm ? "alarms up to one month" :
+		                        "alarms up to one day") :
+		        "no alarms";

Feel free to use the following or your own version as long as the
resulting message is correct.
Thanks.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -794,17 +794,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
 		goto cleanup2;
 	}
 
-	pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
-			cmos_rtc.rtc->dev.bus_id,
-			is_valid_irq(rtc_irq)
-				?  (cmos_rtc.mon_alrm
-					? "year"
-					: (cmos_rtc.day_alrm
-						? "month" : "day"))
-				: "no",
-			cmos_rtc.century ? ", y3k" : "",
-			nvram.size,
-			is_hpet_enabled() ? ", hpet irqs" : "");
+	pr_info("%s: %s%s, %zd bytes nvram%s\n",
+		cmos_rtc.rtc->dev.bus_id,
+		!is_valid_irq(rtc_irq) ? "no alarms" :
+			cmos_rtc.mon_alrm ? "alarms up to one year" :
+			cmos_rtc.day_alrm ? "alarms up to one month" :
+			"alarms up to one day",
+		cmos_rtc.century ? ", y3k" : "",
+		nvram.size,
+		is_hpet_enabled() ? ", hpet irqs" : "");
 
 	return 0;
 
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, now with SOB
  2009-04-04 19:32     ` Krzysztof Halasa
@ 2009-04-09 20:15       ` Andrew Morton
  2009-04-14 21:53         ` Krzysztof Halasa
  2009-04-15 13:31         ` [PATCH] fix RTC-CMOS message, against 2.6.30-rc2 Krzysztof Halasa
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Morton @ 2009-04-09 20:15 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: david-b, linux-kernel

On Sat, 04 Apr 2009 21:32:27 +0200
Krzysztof Halasa <khc@pm.waw.pl> wrote:

> +		        (cmos_rtc.mon_alrm ? "alarms up to one year" :
> +		                cmos_rtc.day_alrm ? "alarms up to one month" :
> +		                        "alarms up to one day") :
> +		        "no alarms";
> 
> Feel free to use the following or your own version as long as the
> resulting message is correct.
> Thanks.
> 
> Signed-off-by: Krzysztof Ha__asa <khc@pm.waw.pl>

Please resend the full changelog (possibly with updates) with each
updated version of a patch.

> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -794,17 +794,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
>  		goto cleanup2;
>  	}
>  
> -	pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
> -			cmos_rtc.rtc->dev.bus_id,
> -			is_valid_irq(rtc_irq)
> -				?  (cmos_rtc.mon_alrm
> -					? "year"
> -					: (cmos_rtc.day_alrm
> -						? "month" : "day"))
> -				: "no",
> -			cmos_rtc.century ? ", y3k" : "",
> -			nvram.size,
> -			is_hpet_enabled() ? ", hpet irqs" : "");
> +	pr_info("%s: %s%s, %zd bytes nvram%s\n",
> +		cmos_rtc.rtc->dev.bus_id,
> +		!is_valid_irq(rtc_irq) ? "no alarms" :
> +			cmos_rtc.mon_alrm ? "alarms up to one year" :
> +			cmos_rtc.day_alrm ? "alarms up to one month" :
> +			"alarms up to one day",
> +		cmos_rtc.century ? ", y3k" : "",
> +		nvram.size,
> +		is_hpet_enabled() ? ", hpet irqs" : "");
>  
>  	return 0;

The patch doesn't apply to current kernels (the driver core guys have
been running rampant again, methinks).  Please redo, retest, resend?

Thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, now with SOB
  2009-04-09 20:15       ` Andrew Morton
@ 2009-04-14 21:53         ` Krzysztof Halasa
  2009-04-15 13:31         ` [PATCH] fix RTC-CMOS message, against 2.6.30-rc2 Krzysztof Halasa
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Halasa @ 2009-04-14 21:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: david-b, linux-kernel

Andrew Morton <akpm@linux-foundation.org> writes:

> The patch doesn't apply to current kernels (the driver core guys have
> been running rampant again, methinks).  Please redo, retest, resend?

Sure, will do.
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix RTC-CMOS message, against 2.6.30-rc2
  2009-04-09 20:15       ` Andrew Morton
  2009-04-14 21:53         ` Krzysztof Halasa
@ 2009-04-15 13:31         ` Krzysztof Halasa
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Halasa @ 2009-04-15 13:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: david-b, linux-kernel

With no IRQ available/defined, RTC-CMOS driver prints something like:
	rtc0: alarms up to one no, y3k, 114 bytes nvram
                              ^^^^
I guess the following is a bit easier to understand:
	rtc0: no alarms, y3k, 114 bytes nvram

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index b6d35f5..23e10b6 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -797,17 +797,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
 		goto cleanup2;
 	}
 
-	pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
-			dev_name(&cmos_rtc.rtc->dev),
-			is_valid_irq(rtc_irq)
-				?  (cmos_rtc.mon_alrm
-					? "year"
-					: (cmos_rtc.day_alrm
-						? "month" : "day"))
-				: "no",
-			cmos_rtc.century ? ", y3k" : "",
-			nvram.size,
-			is_hpet_enabled() ? ", hpet irqs" : "");
+	pr_info("%s: %s%s, %zd bytes nvram%s\n",
+		dev_name(&cmos_rtc.rtc->dev),
+		!is_valid_irq(rtc_irq) ? "no alarms" :
+			cmos_rtc.mon_alrm ? "alarms up to one year" :
+			cmos_rtc.day_alrm ? "alarms up to one month" :
+			"alarms up to one day",
+		cmos_rtc.century ? ", y3k" : "",
+		nvram.size,
+		is_hpet_enabled() ? ", hpet irqs" : "");
 
 	return 0;
 

-- 
Krzysztof Halasa

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-15 13:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-02 16:52 [PATCH] fix RTC-CMOS message Krzysztof Halasa
2009-04-02 16:57 ` [PATCH] fix RTC-CMOS message, now with SOB Krzysztof Halasa
2009-04-04 18:02   ` David Brownell
2009-04-04 19:32     ` Krzysztof Halasa
2009-04-09 20:15       ` Andrew Morton
2009-04-14 21:53         ` Krzysztof Halasa
2009-04-15 13:31         ` [PATCH] fix RTC-CMOS message, against 2.6.30-rc2 Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).