* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used [not found] ` <8066.1277750854@redhat.com> @ 2010-06-29 3:23 ` Justin P. Mattock 2010-06-29 15:47 ` David Howells 1 sibling, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-06-29 3:23 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb o.k. after stepping out for a while.. I'm finally sitting down and looking at this. below is what I came up with.. hopefully it's in the area/vecinity of what might be a good idea for this(if not then let me know) From da5cfa463f29ff3fe4af3874649db0809e50ab96 Mon Sep 17 00:00:00 2001 From: Justin P. Mattock <justinmattock@gmail.com> Date: Mon, 28 Jun 2010 20:14:50 -0700 Subject: [PATCH] glue.c Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> --- drivers/acpi/glue.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4af6301..970d7f3 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) { struct acpi_device *acpi_dev; acpi_status status; + int fn, pn; if (dev->archdata.acpi_handle) { dev_warn(dev, "Drivers changed 'acpi_handle'\n"); @@ -160,12 +161,17 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) status = acpi_bus_get_device(handle, &acpi_dev); if (!ACPI_FAILURE(status)) { - int ret; - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, + fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, "firmware_node"); - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, + pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, "physical_node"); + if (fn) { + printk(KERN_WARNING "dev%d: Failed to create firmware_node: %d\n", status, fn); + }else if (pn) { + printk(KERN_WARNING "dev%d: Failed to create physical_node: %d\n", status, pn); + return 0; + } if (acpi_dev->wakeup.flags.valid) { device_set_wakeup_capable(dev, true); device_set_wakeup_enable(dev, -- 1.7.1.rc1.21.gf3bd6 keep in mind Im not exactly sure what should go into the printk as for words to say, and functions, so I just used status, fn/pn for the two because I was getting a not enough function error. Justin P. Mattock ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used [not found] ` <8066.1277750854@redhat.com> 2010-06-29 3:23 ` [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used Justin P. Mattock @ 2010-06-29 15:47 ` David Howells 2010-06-29 17:14 ` Justin P. Mattock ` (2 more replies) 1 sibling, 3 replies; 12+ messages in thread From: David Howells @ 2010-06-29 15:47 UTC (permalink / raw) To: Justin P. Mattock; +Cc: dhowells, linux-kernel, linux-acpi, lenb Justin P. Mattock <justinmattock@gmail.com> wrote: > + if (fn) { > + printk(KERN_WARNING "dev%d: Failed to create > firmware_node: %d\n", status, fn); > + }else if (pn) { > + printk(KERN_WARNING "dev%d: Failed to create > physical_node: %d\n", status, pn); > + return 0; > + } The if-statement should be correctly indented (it's inside another if-body, so needs to be one more tab over) and there needs to be a space before the else. You should probably split your printks up so they don't exceed 80 chars too, for example: printk(KERN_WARNING "dev%d: Failed to create physical_node: %d\n", status, pn); Also 'status' is probably the wrong thing to print as the number in "dev%d". If it worked, that should be unconditionally AE_OK, I think. Can you not use dev_warn() or similar instead or printk? David ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-29 15:47 ` David Howells @ 2010-06-29 17:14 ` Justin P. Mattock 2010-06-29 21:53 ` Justin P. Mattock 2010-06-30 9:13 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-06-29 17:14 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb On 06/29/2010 08:47 AM, David Howells wrote: > Justin P. Mattock<justinmattock@gmail.com> wrote: > >> + if (fn) { >> + printk(KERN_WARNING "dev%d: Failed to create >> firmware_node: %d\n", status, fn); >> + }else if (pn) { >> + printk(KERN_WARNING "dev%d: Failed to create >> physical_node: %d\n", status, pn); >> + return 0; >> + } > > The if-statement should be correctly indented (it's inside another > if-body, so needs to be one more tab over) and there needs to be a space > before the else. > o.k., so it should look something like this: if (fn) { code... } else if (pn) { > You should probably split your printks up so they don't exceed 80 chars too, > for example: > > printk(KERN_WARNING > "dev%d: Failed to create physical_node: %d\n", > status, pn); > > Also 'status' is probably the wrong thing to print as the number in "dev%d". > If it worked, that should be unconditionally AE_OK, I think. Can you not use > dev_warn() or similar instead or printk? > > David > alright, I'll look at this today. I'm not the best at making printks in fact I'm more intimidated by them..(so with this in mind, I'm going to sit and make myself learn this, so I atleast have a better idea of doing these than I have now.) Justin P. Mattock ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-29 15:47 ` David Howells 2010-06-29 17:14 ` Justin P. Mattock @ 2010-06-29 21:53 ` Justin P. Mattock 2010-06-30 9:13 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-06-29 21:53 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb On 06/29/2010 08:47 AM, David Howells wrote: > Justin P. Mattock<justinmattock@gmail.com> wrote: > >> + if (fn) { >> + printk(KERN_WARNING "dev%d: Failed to create >> firmware_node: %d\n", status, fn); >> + }else if (pn) { >> + printk(KERN_WARNING "dev%d: Failed to create >> physical_node: %d\n", status, pn); >> + return 0; >> + } > > The if-statement should be correctly indented (it's inside another > if-body, so needs to be one more tab over) and there needs to be a space > before the else. > > You should probably split your printks up so they don't exceed 80 chars too, > for example: > > printk(KERN_WARNING > "dev%d: Failed to create physical_node: %d\n", > status, pn); > > Also 'status' is probably the wrong thing to print as the number in "dev%d". > If it worked, that should be unconditionally AE_OK, I think. Can you not use > dev_warn() or similar instead or printk? > > David > o.k. heres another go at this.. this goes through, using dev_warn but am uncertain about using these three for the right info dev, %p, dev_acpi but give it a look whenever you have the time, and let me know then I'll go from there.. From 34485b5709dc9ad18c57be8c672236580300e05c Mon Sep 17 00:00:00 2001 From: Justin P. Mattock <justinmattock@gmail.com> Date: Tue, 29 Jun 2010 14:47:42 -0700 Subject: [PATCH ]ACPI:glue.c Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> --- drivers/acpi/glue.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4af6301..69ca24d 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) { struct acpi_device *acpi_dev; acpi_status status; + int fn, pn; if (dev->archdata.acpi_handle) { dev_warn(dev, "Drivers changed 'acpi_handle'\n"); @@ -160,12 +161,20 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) status = acpi_bus_get_device(handle, &acpi_dev); if (!ACPI_FAILURE(status)) { - int ret; - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, + fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, "firmware_node"); - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, + pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, "physical_node"); + if (fn) { + dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n", + acpi_dev, fn); + + } else if (pn) { + dev_warn(dev, "dev:%p Failed to create physical_node: %d\n", + acpi_dev, pn); + return AE_ERROR; + } if (acpi_dev->wakeup.flags.valid) { device_set_wakeup_capable(dev, true); device_set_wakeup_enable(dev, -- 1.7.1.rc1.21.gf3bd6 Justin P. Mattock ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-29 15:47 ` David Howells 2010-06-29 17:14 ` Justin P. Mattock 2010-06-29 21:53 ` Justin P. Mattock @ 2010-06-30 9:13 ` David Howells 2010-06-30 13:21 ` Justin P. Mattock ` (2 more replies) 2 siblings, 3 replies; 12+ messages in thread From: David Howells @ 2010-06-30 9:13 UTC (permalink / raw) To: Justin P. Mattock; +Cc: dhowells, linux-kernel, linux-acpi, lenb Justin P. Mattock <justinmattock@gmail.com> wrote: > if (!ACPI_FAILURE(status)) { > - int ret; > > - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, > + fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, > "firmware_node"); > - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, > + pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, > "physical_node"); > + if (fn) { That new if-statement still needs indenting one more tab stop. It's indented the same as the previous if-statement, but is actually in the body of that previous if-statement. The body of the second if-statement should be indented one tab beyond the if, and else/else-if statements and the final closing brace should be indented level with the if: if (...) { body; } else if (...) { body; } else { body; } so that they line up vertically. > + dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n", > + acpi_dev, fn); The "dev:%p " seems like it ought to be superfluous if you're using dev_warn(), and certainly, returning the pointer isn't really useful, I suspect. However, at this point you have two device struct pointers: dev and &acip_dev->dev, so printing them both is may be good. Perhaps something like: + dev_warn(&acpi_dev->dev, + "Failed to create firmware_node link to %s %s: %d\n", + dev_driver_string(dev), dev_name(dev), fn); David ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-30 9:13 ` David Howells @ 2010-06-30 13:21 ` Justin P. Mattock 2010-06-30 19:47 ` Justin P. Mattock 2010-07-01 9:31 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-06-30 13:21 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb On 06/30/2010 02:13 AM, David Howells wrote: > Justin P. Mattock<justinmattock@gmail.com> wrote: > >> if (!ACPI_FAILURE(status)) { >> - int ret; >> >> - ret = sysfs_create_link(&dev->kobj,&acpi_dev->dev.kobj, >> + fn = sysfs_create_link(&dev->kobj,&acpi_dev->dev.kobj, >> "firmware_node"); >> - ret = sysfs_create_link(&acpi_dev->dev.kobj,&dev->kobj, >> + pn = sysfs_create_link(&acpi_dev->dev.kobj,&dev->kobj, >> "physical_node"); >> + if (fn) { > > That new if-statement still needs indenting one more tab stop. It's indented > the same as the previous if-statement, but is actually in the body of that > previous if-statement. > > The body of the second if-statement should be indented one tab beyond the if, > and else/else-if statements and the final closing brace should be indented > level with the if: > > if (...) { > body; > } else if (...) { > body; > } else { > body; > } > > so that they line up vertically. Thanks for the info on this, I really appreciate it. I'll look at this today, and resend. > >> + dev_warn(dev, "dev:%p Failed to create firmware_node: %d\n", >> + acpi_dev, fn); > > The "dev:%p " seems like it ought to be superfluous if you're using > dev_warn(), and certainly, returning the pointer isn't really useful, I > suspect. > I kept receiving an new warning for using acpi_dev the %p was the only option I saw in the Documentation that worked > However, at this point you have two device struct pointers: dev and > &acip_dev->dev, so printing them both is may be good. Perhaps something like: > > + dev_warn(&acpi_dev->dev, > + "Failed to create firmware_node link to %s %s: %d\n", > + dev_driver_string(dev), dev_name(dev), fn); > > David > o.k. I'll look at this today, and see if I can find/locate the device name and string for these. Justin P. Mattock ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-30 9:13 ` David Howells 2010-06-30 13:21 ` Justin P. Mattock @ 2010-06-30 19:47 ` Justin P. Mattock 2010-07-01 9:31 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-06-30 19:47 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb o.k. hopefully this is getting close to being right.. I ended up spending the later half of the morning looking for dev_driver_string(dev) until I read device.h and realized you actually use that it's self to gather the debug info etc..(I admit it, I'm a newbie!) anyways here is the updated patch, let me know if something need a changing.. From 16df81551d1899e650ae28ea8d41931f7c391c7a Mon Sep 17 00:00:00 2001 From: Justin P. Mattock <justinmattock@gmail.com> Date: Wed, 30 Jun 2010 12:34:32 -0700 Subject: [PATCH]acpi:glue.c Fix Fix warning: variable 'ret' set but not used Fix a warning message generated by gcc: Im getting a warning message when building with gcc 4.6.0 CC drivers/acpi/glue.o drivers/acpi/glue.c: In function 'acpi_bind_one': drivers/acpi/glue.c:163:7: warning: variable 'ret' set but not used Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> --- drivers/acpi/glue.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4af6301..11ad510 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) { struct acpi_device *acpi_dev; acpi_status status; + int fn, pn; if (dev->archdata.acpi_handle) { dev_warn(dev, "Drivers changed 'acpi_handle'\n"); @@ -160,12 +161,21 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) status = acpi_bus_get_device(handle, &acpi_dev); if (!ACPI_FAILURE(status)) { - int ret; - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, + fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, "firmware_node"); - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, + pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, "physical_node"); + if (fn) { + dev_warn(&acpi_dev->dev, + "Failed to create firmware_node link to %s %s: %d\n", + dev_driver_string(dev), dev_name(dev), fn); + } else if (pn) { + dev_warn(&acpi_dev->dev, + "Failed to create physical_node link to %s %s: %d\n", + dev_driver_string(dev), dev_name(dev), pn); + return AE_ERROR; + } if (acpi_dev->wakeup.flags.valid) { device_set_wakeup_capable(dev, true); device_set_wakeup_enable(dev, -- 1.7.1.rc1.21.gf3bd6 cheers, Justin P. Mattock ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-06-30 9:13 ` David Howells 2010-06-30 13:21 ` Justin P. Mattock 2010-06-30 19:47 ` Justin P. Mattock @ 2010-07-01 9:31 ` David Howells 2010-07-01 13:41 ` Justin P. Mattock ` (2 more replies) 2 siblings, 3 replies; 12+ messages in thread From: David Howells @ 2010-07-01 9:31 UTC (permalink / raw) To: Justin P. Mattock; +Cc: dhowells, linux-kernel, linux-acpi, lenb Justin P. Mattock <justinmattock@gmail.com> wrote: > + if (fn) { > + dev_warn(&acpi_dev->dev, > + "Failed to create firmware_node link to %s %s: %d\n", > + dev_driver_string(dev), dev_name(dev), fn); > + } else if (pn) { > + dev_warn(&acpi_dev->dev, > + "Failed to create physical_node link to %s %s: %d\n", > + dev_driver_string(dev), dev_name(dev), pn); > + return AE_ERROR; > + } There's one more question to ask yourself: do you really need two dev_warn() statements? You could have just one that prints both error values: if (fn || pn) dev_warn(&acpi_dev->dev, "Failed to create link(s) to %s %s:" " fn=%d pn=%d\n", dev_driver_string(dev), dev_name(dev), fn, pn); Not sure it's worth going that far. You could reduce it still further: if (fn || pn) dev_warn(&acpi_dev->dev, "Failed to create link(s) to %s %s:" " %d\n", dev_driver_string(dev), dev_name(dev), fn ?: pn); Is it that important to know which failed to be created, or that both failed to be created? David ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-07-01 9:31 ` David Howells @ 2010-07-01 13:41 ` Justin P. Mattock 2010-07-01 20:01 ` Justin P. Mattock 2010-07-02 0:10 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-07-01 13:41 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb On 07/01/2010 02:31 AM, David Howells wrote: > Justin P. Mattock<justinmattock@gmail.com> wrote: > >> + if (fn) { >> + dev_warn(&acpi_dev->dev, >> + "Failed to create firmware_node link to %s %s: %d\n", >> + dev_driver_string(dev), dev_name(dev), fn); >> + } else if (pn) { >> + dev_warn(&acpi_dev->dev, >> + "Failed to create physical_node link to %s %s: %d\n", >> + dev_driver_string(dev), dev_name(dev), pn); >> + return AE_ERROR; >> + } > > There's one more question to ask yourself: do you really need two dev_warn() > statements? You could have just one that prints both error values: > > if (fn || pn) > dev_warn(&acpi_dev->dev, > "Failed to create link(s) to %s %s:" > " fn=%d pn=%d\n", > dev_driver_string(dev), dev_name(dev), > fn, pn); ah... I did think about that a few days ago, but had no idea how to really follow through with this.. and from looking at what you did, it's as simple as a || b > > Not sure it's worth going that far. You could reduce it still further: > > if (fn || pn) > dev_warn(&acpi_dev->dev, > "Failed to create link(s) to %s %s:" > " %d\n", > dev_driver_string(dev), dev_name(dev), > fn ?: pn); I don't mind resending with your change to this. > > Is it that important to know which failed to be created, or that both failed > to be created? > > David > maybe a simple test(prog) case can be created to simulate what this is doing, just to make sure. Justin P. Mattock ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-07-01 9:31 ` David Howells 2010-07-01 13:41 ` Justin P. Mattock @ 2010-07-01 20:01 ` Justin P. Mattock 2010-07-02 0:10 ` David Howells 2 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-07-01 20:01 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb > Not sure it's worth going that far. You could reduce it still further: > > if (fn || pn) > dev_warn(&acpi_dev->dev, > "Failed to create link(s) to %s %s:" > " %d\n", > dev_driver_string(dev), dev_name(dev), > fn ?: pn); > > Is it that important to know which failed to be created, or that both failed > to be created? > > David > I like this.. fn ?: pn (will this give us the results from the above question? _both failed to be created_) a bit confused with the whole: "?:" though *condition ? value if true : value if false* (what if both are true what if both are false or does it matter?) here is the patch itself with the change: Fix a warning message generated by gcc: Im getting a warning message when building with gcc 4.6.0 CC drivers/acpi/glue.o drivers/acpi/glue.c: In function 'acpi_bind_one': drivers/acpi/glue.c:163:7: warning: variable 'ret' set but not used Signed-off-by: Justin P. Mattock <justinmattock@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com> --- drivers/acpi/glue.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4af6301..23b16e6 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -145,6 +145,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) { struct acpi_device *acpi_dev; acpi_status status; + int fn, pn; if (dev->archdata.acpi_handle) { dev_warn(dev, "Drivers changed 'acpi_handle'\n"); @@ -160,12 +161,19 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) status = acpi_bus_get_device(handle, &acpi_dev); if (!ACPI_FAILURE(status)) { - int ret; - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, + fn = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, "firmware_node"); - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, + pn = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, "physical_node"); + if (fn || pn) { + dev_warn(&acpi_dev->dev, + "Failed to create link(s) to %s %s:" + " %d\n", + dev_driver_string(dev), dev_name(dev), + fn ?: pn); + return AE_ERROR; + } if (acpi_dev->wakeup.flags.valid) { device_set_wakeup_capable(dev, true); device_set_wakeup_enable(dev, -- 1.7.1.rc1.21.gf3bd6 Justin P. Mattock ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-07-01 9:31 ` David Howells 2010-07-01 13:41 ` Justin P. Mattock 2010-07-01 20:01 ` Justin P. Mattock @ 2010-07-02 0:10 ` David Howells 2010-07-02 0:59 ` Justin P. Mattock 2 siblings, 1 reply; 12+ messages in thread From: David Howells @ 2010-07-02 0:10 UTC (permalink / raw) To: Justin P. Mattock; +Cc: dhowells, linux-kernel, linux-acpi, lenb Justin P. Mattock <justinmattock@gmail.com> wrote: > a bit confused with the whole: "?:" though > *condition ? value if true : value if false* (what if both are true > what if both are false or does it matter?) If you say: cond ?: false_value then you'll get cond if cond is non-zero and false_value if it isn't. I suspect it's a gccism. David ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used 2010-07-02 0:10 ` David Howells @ 2010-07-02 0:59 ` Justin P. Mattock 0 siblings, 0 replies; 12+ messages in thread From: Justin P. Mattock @ 2010-07-02 0:59 UTC (permalink / raw) To: David Howells; +Cc: linux-kernel, linux-acpi, lenb On 07/01/2010 05:10 PM, David Howells wrote: > Justin P. Mattock<justinmattock@gmail.com> wrote: > >> a bit confused with the whole: "?:" though >> *condition ? value if true : value if false* (what if both are true >> what if both are false or does it matter?) > > If you say: > > cond ?: false_value > > then you'll get cond if cond is non-zero and false_value if it isn't. > > I suspect it's a gccism. > > David > I'll have to experiment with this one.. ?: Justin P. Mattock ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-07-02 0:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4C28E14D.5050701@gmail.com>
[not found] ` <1277621246-10960-4-git-send-email-justinmattock@gmail.com>
[not found] ` <1277621246-10960-1-git-send-email-justinmattock@gmail.com>
[not found] ` <7214.1277729293@redhat.com>
[not found] ` <8066.1277750854@redhat.com>
2010-06-29 3:23 ` [PATCH 3/5]acpi:glue.c Fix warning: variable 'ret' set but not used Justin P. Mattock
2010-06-29 15:47 ` David Howells
2010-06-29 17:14 ` Justin P. Mattock
2010-06-29 21:53 ` Justin P. Mattock
2010-06-30 9:13 ` David Howells
2010-06-30 13:21 ` Justin P. Mattock
2010-06-30 19:47 ` Justin P. Mattock
2010-07-01 9:31 ` David Howells
2010-07-01 13:41 ` Justin P. Mattock
2010-07-01 20:01 ` Justin P. Mattock
2010-07-02 0:10 ` David Howells
2010-07-02 0:59 ` Justin P. Mattock
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).