* [patch 0/6] PNP: minor cleanups
@ 2007-08-15 16:32 Bjorn Helgaas
2007-08-15 16:32 ` [patch 1/6] PNP: fix up after Lindent Bjorn Helgaas
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
Fix a few more Lindent things and remove some unused code and
unnecessary casts.
The last patch removes some null pointer checks in cases where
I think it's better to just oops immediately rather than return
an error.
Bjorn
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 1/6] PNP: fix up after Lindent
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-15 16:32 ` [patch 2/6] PNPACPI: simplify irq_flags() Bjorn Helgaas
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-lindent-fixup2 --]
[-- Type: text/plain, Size: 7140 bytes --]
More manual fixups after Lindent. No functional change.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/card.c
===================================================================
--- w.orig/drivers/pnp/card.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/card.c 2007-08-14 10:08:15.000000000 -0600
@@ -25,13 +25,13 @@
int found;
struct pnp_dev *dev;
- if (i == PNP_MAX_DEVICES
- || !*drv_id->devs[i].id)
+ if (i == PNP_MAX_DEVICES ||
+ !*drv_id->devs[i].id)
return drv_id;
found = 0;
card_for_each_dev(card, dev) {
- if (compare_pnp_id
- (dev->id, drv_id->devs[i].id)) {
+ if (compare_pnp_id(dev->id,
+ drv_id->devs[i].id)) {
found = 1;
break;
}
@@ -183,7 +183,7 @@
return 0;
- err_name:
+err_name:
device_remove_file(&card->dev, &dev_attr_name);
return rc;
}
@@ -321,10 +321,10 @@
pos = pos->next;
}
- done:
+done:
return NULL;
- found:
+found:
dev->card_link = clink;
dev->dev.driver = &drv->link.driver;
if (pnp_bus_type.probe(&dev->dev))
@@ -334,7 +334,7 @@
return dev;
- err_out:
+err_out:
dev->dev.driver = NULL;
dev->card_link = NULL;
return NULL;
Index: w/drivers/pnp/driver.c
===================================================================
--- w.orig/drivers/pnp/driver.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/driver.c 2007-08-14 10:26:12.000000000 -0600
@@ -118,7 +118,7 @@
goto fail;
return error;
- fail:
+fail:
pnp_device_detach(pnp_dev);
return error;
}
Index: w/drivers/pnp/interface.c
===================================================================
--- w.orig/drivers/pnp/interface.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/interface.c 2007-08-14 10:08:48.000000000 -0600
@@ -459,7 +459,8 @@
up(&pnp_res_mutex);
goto done;
}
- done:
+
+done:
if (retval < 0)
return retval;
return count;
@@ -499,10 +500,10 @@
return 0;
- err_res:
+err_res:
device_remove_file(&dev->dev, &dev_attr_resources);
- err_opt:
+err_opt:
device_remove_file(&dev->dev, &dev_attr_options);
- err:
+err:
return rc;
}
Index: w/drivers/pnp/isapnp/core.c
===================================================================
--- w.orig/drivers/pnp/isapnp/core.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/isapnp/core.c 2007-08-14 10:26:12.000000000 -0600
@@ -335,7 +335,7 @@
} else if (iteration > 1) {
break;
}
- __next:
+__next:
if (csn == 255)
break;
checksum = 0x6a;
@@ -733,7 +733,7 @@
"isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n",
type, dev->number, card->number);
}
- __skip:
+__skip:
if (size > 0)
isapnp_skip_bytes(size);
}
@@ -788,7 +788,7 @@
"isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n",
type, card->number);
}
- __skip:
+__skip:
if (size > 0)
isapnp_skip_bytes(size);
}
@@ -940,9 +940,6 @@
EXPORT_SYMBOL(isapnp_present);
EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
-#if 0
-EXPORT_SYMBOL(isapnp_read_byte);
-#endif
EXPORT_SYMBOL(isapnp_write_byte);
static int isapnp_read_resources(struct pnp_dev *dev,
@@ -993,6 +990,7 @@
struct pnp_resource_table *res)
{
int ret;
+
pnp_init_resource_table(res);
isapnp_cfg_begin(dev->card->number, dev->number);
ret = isapnp_read_resources(dev, res);
@@ -1148,13 +1146,12 @@
}
}
}
- if (cards) {
+ if (cards)
printk(KERN_INFO
"isapnp: %i Plug & Play card%s detected total\n", cards,
cards > 1 ? "s" : "");
- } else {
+ else
printk(KERN_INFO "isapnp: No Plug & Play card found\n");
- }
isapnp_proc_init();
return 0;
Index: w/drivers/pnp/manager.c
===================================================================
--- w.orig/drivers/pnp/manager.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/manager.c 2007-08-14 10:26:12.000000000 -0600
@@ -390,7 +390,7 @@
up(&pnp_res_mutex);
return 1;
- fail:
+fail:
pnp_clean_resource_table(&dev->res);
up(&pnp_res_mutex);
return 0;
@@ -444,7 +444,7 @@
kfree(bak);
return 0;
- fail:
+fail:
dev->res = *bak;
up(&pnp_res_mutex);
kfree(bak);
Index: w/drivers/pnp/pnpacpi/core.c
===================================================================
--- w.orig/drivers/pnp/pnpacpi/core.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/pnpacpi/core.c 2007-08-14 10:08:15.000000000 -0600
@@ -248,9 +248,9 @@
num++;
return AE_OK;
- err1:
+err1:
kfree(dev_id);
- err:
+err:
kfree(dev);
return -EINVAL;
}
Index: w/drivers/pnp/pnpbios/proc.c
===================================================================
--- w.orig/drivers/pnp/pnpbios/proc.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/pnpbios/proc.c 2007-08-14 10:08:15.000000000 -0600
@@ -212,7 +212,7 @@
goto out;
}
ret = count;
- out:
+out:
kfree(node);
return ret;
}
Index: w/drivers/pnp/pnpbios/rsparser.c
===================================================================
--- w.orig/drivers/pnp/pnpbios/rsparser.c 2007-08-14 10:01:11.000000000 -0600
+++ w/drivers/pnp/pnpbios/rsparser.c 2007-08-14 10:23:45.000000000 -0600
@@ -238,7 +238,7 @@
break;
default: /* an unkown tag */
- len_err:
+len_err:
printk(KERN_ERR
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len);
@@ -298,6 +298,7 @@
struct pnp_option *option)
{
struct pnp_mem *mem;
+
mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
if (!mem)
return;
@@ -468,7 +469,7 @@
return p + 2;
default: /* an unkown tag */
- len_err:
+len_err:
printk(KERN_ERR
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len);
@@ -562,7 +563,7 @@
break;
default: /* an unkown tag */
- len_err:
+len_err:
printk(KERN_ERR
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len);
@@ -756,7 +757,7 @@
break;
default: /* an unkown tag */
- len_err:
+len_err:
printk(KERN_ERR
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len);
Index: w/drivers/pnp/pnpacpi/rsparser.c
===================================================================
--- w.orig/drivers/pnp/pnpacpi/rsparser.c 2007-08-14 10:26:16.000000000 -0600
+++ w/drivers/pnp/pnpacpi/rsparser.c 2007-08-14 10:33:20.000000000 -0600
@@ -35,6 +35,7 @@
static int irq_flags(int triggering, int polarity)
{
int flag;
+
if (triggering == ACPI_LEVEL_SENSITIVE) {
if (polarity == ACPI_ACTIVE_LOW)
flag = IORESOURCE_IRQ_LOWLEVEL;
Index: w/drivers/pnp/pnpbios/core.c
===================================================================
--- w.orig/drivers/pnp/pnpbios/core.c 2007-08-14 10:33:24.000000000 -0600
+++ w/drivers/pnp/pnpbios/core.c 2007-08-14 10:33:47.000000000 -0600
@@ -591,6 +591,7 @@
static int __init pnpbios_thread_init(void)
{
struct task_struct *task;
+
#if defined(CONFIG_PPC_MERGE)
if (check_legacy_ioport(PNPBIOS_BASE))
return 0;
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 2/6] PNPACPI: simplify irq_flags()
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
2007-08-15 16:32 ` [patch 1/6] PNP: fix up after Lindent Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-15 16:32 ` [patch 3/6] PNPACPI: remove unnecessary casts of "void *" Bjorn Helgaas
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-simplify-irq-flags --]
[-- Type: text/plain, Size: 1013 bytes --]
No need for a temporary variable; just return the flags once we know them.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/pnpacpi/rsparser.c
===================================================================
--- w.orig/drivers/pnp/pnpacpi/rsparser.c 2007-08-14 11:46:58.000000000 -0600
+++ w/drivers/pnp/pnpacpi/rsparser.c 2007-08-14 11:47:17.000000000 -0600
@@ -34,20 +34,17 @@
*/
static int irq_flags(int triggering, int polarity)
{
- int flag;
-
if (triggering == ACPI_LEVEL_SENSITIVE) {
if (polarity == ACPI_ACTIVE_LOW)
- flag = IORESOURCE_IRQ_LOWLEVEL;
+ return IORESOURCE_IRQ_LOWLEVEL;
else
- flag = IORESOURCE_IRQ_HIGHLEVEL;
+ return IORESOURCE_IRQ_HIGHLEVEL;
} else {
if (polarity == ACPI_ACTIVE_LOW)
- flag = IORESOURCE_IRQ_LOWEDGE;
+ return IORESOURCE_IRQ_LOWEDGE;
else
- flag = IORESOURCE_IRQ_HIGHEDGE;
+ return IORESOURCE_IRQ_HIGHEDGE;
}
- return flag;
}
static void decode_irq_flags(int flag, int *triggering, int *polarity)
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 3/6] PNPACPI: remove unnecessary casts of "void *"
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
2007-08-15 16:32 ` [patch 1/6] PNP: fix up after Lindent Bjorn Helgaas
2007-08-15 16:32 ` [patch 2/6] PNPACPI: simplify irq_flags() Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-15 16:32 ` [patch 4/6] ISAPNP: removed unused isapnp_detected and ISAPNP_DEBUG Bjorn Helgaas
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-remove-unnecessary-casts --]
[-- Type: text/plain, Size: 1842 bytes --]
Remove unnecessary casts of void pointers.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/pnpacpi/rsparser.c
===================================================================
--- w.orig/drivers/pnp/pnpacpi/rsparser.c 2007-08-15 09:47:43.000000000 -0600
+++ w/drivers/pnp/pnpacpi/rsparser.c 2007-08-15 09:47:48.000000000 -0600
@@ -240,8 +240,7 @@
static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
void *data)
{
- struct pnp_resource_table *res_table =
- (struct pnp_resource_table *)data;
+ struct pnp_resource_table *res_table = data;
int i;
switch (res->type) {
@@ -564,8 +563,7 @@
void *data)
{
int priority = 0;
- struct acpipnp_parse_option_s *parse_data =
- (struct acpipnp_parse_option_s *)data;
+ struct acpipnp_parse_option_s *parse_data = data;
struct pnp_dev *dev = parse_data->dev;
struct pnp_option *option = parse_data->option;
@@ -703,7 +701,7 @@
static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
void *data)
{
- int *res_cnt = (int *)data;
+ int *res_cnt = data;
if (pnpacpi_supported_resource(res))
(*res_cnt)++;
@@ -712,7 +710,7 @@
static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
{
- struct acpi_resource **resource = (struct acpi_resource **)data;
+ struct acpi_resource **resource = data;
if (pnpacpi_supported_resource(res)) {
(*resource)->type = res->type;
@@ -884,8 +882,7 @@
int i = 0;
/* pnpacpi_build_resource_template allocates extra mem */
int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
- struct acpi_resource *resource =
- (struct acpi_resource *)buffer->pointer;
+ struct acpi_resource *resource = buffer->pointer;
int port = 0, irq = 0, dma = 0, mem = 0;
pnp_dbg("res cnt %d", res_cnt);
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 4/6] ISAPNP: removed unused isapnp_detected and ISAPNP_DEBUG
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
` (2 preceding siblings ...)
2007-08-15 16:32 ` [patch 3/6] PNPACPI: remove unnecessary casts of "void *" Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-15 16:32 ` [patch 5/6] PNP: remove MODULE infrastructure Bjorn Helgaas
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-remove-unused-isapnp-stuff --]
[-- Type: text/plain, Size: 1377 bytes --]
ISAPNP_DEBUG isn't used at all. isapnp_detected is set but never read.
So remove them both.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/isapnp/core.c
===================================================================
--- w.orig/drivers/pnp/isapnp/core.c 2007-08-14 11:49:46.000000000 -0600
+++ w/drivers/pnp/isapnp/core.c 2007-08-14 11:51:51.000000000 -0600
@@ -47,9 +47,6 @@
#if 0
#define ISAPNP_REGION_OK
#endif
-#if 0
-#define ISAPNP_DEBUG
-#endif
int isapnp_disable; /* Disable ISA PnP */
static int isapnp_rdp; /* Read Data Port */
@@ -93,7 +90,6 @@
static unsigned char isapnp_checksum_value;
static DEFINE_MUTEX(isapnp_cfg_mutex);
-static int isapnp_detected;
static int isapnp_csn_count;
/* some prototypes */
@@ -1067,7 +1063,6 @@
struct pnp_dev *dev;
if (isapnp_disable) {
- isapnp_detected = 0;
printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
return 0;
}
@@ -1115,7 +1110,6 @@
}
isapnp_set_rdp();
}
- isapnp_detected = 1;
if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) {
cards = isapnp_isolate();
if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
@@ -1123,7 +1117,6 @@
release_region(_PIDXR, 1);
#endif
release_region(_PNPWRP, 1);
- isapnp_detected = 0;
printk(KERN_INFO
"isapnp: No Plug & Play device found\n");
return 0;
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 5/6] PNP: remove MODULE infrastructure
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
` (3 preceding siblings ...)
2007-08-15 16:32 ` [patch 4/6] ISAPNP: removed unused isapnp_detected and ISAPNP_DEBUG Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-15 16:32 ` [patch 6/6] PNP: remove null pointer checks Bjorn Helgaas
2007-08-24 4:52 ` [patch 0/6] PNP: minor cleanups Len Brown
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-remove-unused-module-stuff --]
[-- Type: text/plain, Size: 2954 bytes --]
We don't support building any part of PNP as a module (*drivers* can be
modules, of course, but the PNP infrastructure itself can not). Since
MODULE will never be defined, remove the ifdefs and dead code.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/pnpbios/core.c
===================================================================
--- w.orig/drivers/pnp/pnpbios/core.c 2007-08-14 10:36:03.000000000 -0600
+++ w/drivers/pnp/pnpbios/core.c 2007-08-14 10:37:28.000000000 -0600
@@ -419,7 +419,6 @@
static int pnpbios_disabled;
int pnpbios_dont_use_current_config;
-#ifndef MODULE
static int __init pnpbios_setup(char *str)
{
int invert;
@@ -443,7 +442,6 @@
}
__setup("pnpbios=", pnpbios_setup);
-#endif
/* PnP BIOS signature: "$PnP" */
#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
@@ -607,48 +605,7 @@
return 0;
}
-#ifndef MODULE
-
-/* init/main.c calls pnpbios_init early */
-
/* Start the kernel thread later: */
module_init(pnpbios_thread_init);
-#else
-
-/*
- * N.B.: Building pnpbios as a module hasn't been fully implemented
- */
-
-MODULE_LICENSE("GPL");
-
-static int __init pnpbios_init_all(void)
-{
- int r;
-
- r = pnpbios_init();
- if (r)
- return r;
- r = pnpbios_thread_init();
- if (r)
- return r;
- return 0;
-}
-
-static void __exit pnpbios_exit(void)
-{
-#ifdef CONFIG_HOTPLUG
- unloading = 1;
- wait_for_completion(&unload_sem);
-#endif
- pnpbios_proc_exit();
- /* We ought to free resources here */
- return;
-}
-
-module_init(pnpbios_init_all);
-module_exit(pnpbios_exit);
-
-#endif
-
EXPORT_SYMBOL(pnpbios_protocol);
Index: w/drivers/pnp/isapnp/proc.c
===================================================================
--- w.orig/drivers/pnp/isapnp/proc.c 2007-08-14 10:38:56.000000000 -0600
+++ w/drivers/pnp/isapnp/proc.c 2007-08-14 10:39:12.000000000 -0600
@@ -112,33 +112,6 @@
return 0;
}
-#ifdef MODULE
-static int __exit isapnp_proc_detach_device(struct pnp_dev *dev)
-{
- struct pnp_card *bus = dev->card;
- struct proc_dir_entry *de;
- char name[16];
-
- if (!(de = bus->procdir))
- return -EINVAL;
- sprintf(name, "%02x", dev->number);
- remove_proc_entry(name, de);
- return 0;
-}
-
-static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
-{
- struct proc_dir_entry *de;
- char name[16];
-
- if (!(de = bus->procdir))
- return -EINVAL;
- sprintf(name, "%02x", bus->number);
- remove_proc_entry(name, isapnp_proc_bus_dir);
- return 0;
-}
-#endif /* MODULE */
-
int __init isapnp_proc_init(void)
{
struct pnp_dev *dev;
@@ -149,21 +122,3 @@
}
return 0;
}
-
-#ifdef MODULE
-int __exit isapnp_proc_done(void)
-{
- struct pnp_dev *dev;
- struct pnp_bus *card;
-
- isapnp_for_each_dev(dev) {
- isapnp_proc_detach_device(dev);
- }
- isapnp_for_each_card(card) {
- isapnp_proc_detach_bus(card);
- }
- if (isapnp_proc_bus_dir)
- remove_proc_entry("isapnp", proc_bus);
- return 0;
-}
-#endif /* MODULE */
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 6/6] PNP: remove null pointer checks
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
` (4 preceding siblings ...)
2007-08-15 16:32 ` [patch 5/6] PNP: remove MODULE infrastructure Bjorn Helgaas
@ 2007-08-15 16:32 ` Bjorn Helgaas
2007-08-24 4:52 ` [patch 0/6] PNP: minor cleanups Len Brown
6 siblings, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2007-08-15 16:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: Len Brown, Jaroslav Kysela, Adam Belay, linux-acpi
[-- Attachment #1: pnp-remove-null-pointer-checks --]
[-- Type: text/plain, Size: 5373 bytes --]
Remove some null pointer checks. Null pointers in these areas indicate
programming errors, and I think it's better to oops immediately rather
than return an error that is easily ignored.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: w/drivers/pnp/core.c
===================================================================
--- w.orig/drivers/pnp/core.c 2007-08-14 11:46:03.000000000 -0600
+++ w/drivers/pnp/core.c 2007-08-15 09:52:21.000000000 -0600
@@ -52,9 +52,6 @@
int nodenum;
struct list_head *pos;
- if (!protocol)
- return -EINVAL;
-
INIT_LIST_HEAD(&protocol->devices);
INIT_LIST_HEAD(&protocol->cards);
nodenum = 0;
@@ -94,8 +91,6 @@
struct pnp_id *id;
struct pnp_id *next;
- if (!dev)
- return;
id = dev->id;
while (id) {
next = id->next;
@@ -143,7 +138,7 @@
*/
int pnp_add_device(struct pnp_dev *dev)
{
- if (!dev || !dev->protocol || dev->card)
+ if (dev->card)
return -EINVAL;
dev->dev.parent = &dev->protocol->dev;
sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
Index: w/drivers/pnp/driver.c
===================================================================
--- w.orig/drivers/pnp/driver.c 2007-08-15 09:47:42.000000000 -0600
+++ w/drivers/pnp/driver.c 2007-08-15 09:52:21.000000000 -0600
@@ -232,10 +232,6 @@
{
struct pnp_id *ptr;
- if (!id)
- return -EINVAL;
- if (!dev)
- return -EINVAL;
id->next = NULL;
ptr = dev->id;
while (ptr && ptr->next)
Index: w/drivers/pnp/manager.c
===================================================================
--- w.orig/drivers/pnp/manager.c 2007-08-15 09:47:42.000000000 -0600
+++ w/drivers/pnp/manager.c 2007-08-15 09:52:21.000000000 -0600
@@ -21,9 +21,6 @@
resource_size_t *start, *end;
unsigned long *flags;
- if (!dev || !rule)
- return -EINVAL;
-
if (idx >= PNP_MAX_PORT) {
pnp_err
("More than 4 ports is incompatible with pnp specifications.");
@@ -66,9 +63,6 @@
resource_size_t *start, *end;
unsigned long *flags;
- if (!dev || !rule)
- return -EINVAL;
-
if (idx >= PNP_MAX_MEM) {
pnp_err
("More than 8 mems is incompatible with pnp specifications.");
@@ -127,9 +121,6 @@
5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
};
- if (!dev || !rule)
- return -EINVAL;
-
if (idx >= PNP_MAX_IRQ) {
pnp_err
("More than 2 irqs is incompatible with pnp specifications.");
@@ -181,9 +172,6 @@
1, 3, 5, 6, 7, 0, 2, 4
};
- if (!dev || !rule)
- return -EINVAL;
-
if (idx >= PNP_MAX_DMA) {
pnp_err
("More than 2 dmas is incompatible with pnp specifications.");
@@ -410,8 +398,6 @@
int i;
struct pnp_resource_table *bak;
- if (!dev || !res)
- return -EINVAL;
if (!pnp_can_configure(dev))
return -ENODEV;
bak = pnp_alloc(sizeof(struct pnp_resource_table));
@@ -460,9 +446,6 @@
struct pnp_option *dep;
int i = 1;
- if (!dev)
- return -EINVAL;
-
if (!pnp_can_configure(dev)) {
pnp_dbg("Device %s does not support resource configuration.",
dev->dev.bus_id);
@@ -541,8 +524,6 @@
{
int error;
- if (!dev)
- return -EINVAL;
if (dev->active)
return 0; /* the device is already active */
@@ -568,8 +549,6 @@
{
int error;
- if (!dev)
- return -EINVAL;
if (!dev->active)
return 0; /* the device is already disabled */
@@ -596,8 +575,6 @@
void pnp_resource_change(struct resource *resource, resource_size_t start,
resource_size_t size)
{
- if (resource == NULL)
- return;
resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET);
resource->start = start;
resource->end = start + size - 1;
Index: w/drivers/pnp/resource.c
===================================================================
--- w.orig/drivers/pnp/resource.c 2007-08-14 11:46:03.000000000 -0600
+++ w/drivers/pnp/resource.c 2007-08-15 09:52:21.000000000 -0600
@@ -47,9 +47,6 @@
{
struct pnp_option *option;
- if (!dev)
- return NULL;
-
option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED);
/* this should never happen but if it does we'll try to continue */
@@ -64,9 +61,6 @@
{
struct pnp_option *option;
- if (!dev)
- return NULL;
-
option = pnp_build_option(priority);
if (dev->dependent) {
@@ -83,11 +77,6 @@
{
struct pnp_irq *ptr;
- if (!option)
- return -EINVAL;
- if (!data)
- return -EINVAL;
-
ptr = option->irq;
while (ptr && ptr->next)
ptr = ptr->next;
@@ -112,11 +101,6 @@
{
struct pnp_dma *ptr;
- if (!option)
- return -EINVAL;
- if (!data)
- return -EINVAL;
-
ptr = option->dma;
while (ptr && ptr->next)
ptr = ptr->next;
@@ -132,11 +116,6 @@
{
struct pnp_port *ptr;
- if (!option)
- return -EINVAL;
- if (!data)
- return -EINVAL;
-
ptr = option->port;
while (ptr && ptr->next)
ptr = ptr->next;
@@ -152,11 +131,6 @@
{
struct pnp_mem *ptr;
- if (!option)
- return -EINVAL;
- if (!data)
- return -EINVAL;
-
ptr = option->mem;
while (ptr && ptr->next)
ptr = ptr->next;
Index: w/drivers/pnp/isapnp/core.c
===================================================================
--- w.orig/drivers/pnp/isapnp/core.c 2007-08-15 09:51:17.000000000 -0600
+++ w/drivers/pnp/isapnp/core.c 2007-08-15 09:52:21.000000000 -0600
@@ -1040,7 +1040,7 @@
static int isapnp_disable_resources(struct pnp_dev *dev)
{
- if (!dev || !dev->active)
+ if (!dev->active)
return -EINVAL;
isapnp_cfg_begin(dev->card->number, dev->number);
isapnp_deactivate(dev->number);
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/6] PNP: minor cleanups
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
` (5 preceding siblings ...)
2007-08-15 16:32 ` [patch 6/6] PNP: remove null pointer checks Bjorn Helgaas
@ 2007-08-24 4:52 ` Len Brown
6 siblings, 0 replies; 8+ messages in thread
From: Len Brown @ 2007-08-24 4:52 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Andrew Morton, Jaroslav Kysela, Adam Belay, linux-acpi
On Wednesday 15 August 2007 12:32, Bjorn Helgaas wrote:
> Fix a few more Lindent things and remove some unused code and
> unnecessary casts.
>
> The last patch removes some null pointer checks in cases where
> I think it's better to just oops immediately rather than return
> an error.
These look fine to me.
Unless somebody objects, I'll send them up via my tree.
thanks,
-Len
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-24 4:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 16:32 [patch 0/6] PNP: minor cleanups Bjorn Helgaas
2007-08-15 16:32 ` [patch 1/6] PNP: fix up after Lindent Bjorn Helgaas
2007-08-15 16:32 ` [patch 2/6] PNPACPI: simplify irq_flags() Bjorn Helgaas
2007-08-15 16:32 ` [patch 3/6] PNPACPI: remove unnecessary casts of "void *" Bjorn Helgaas
2007-08-15 16:32 ` [patch 4/6] ISAPNP: removed unused isapnp_detected and ISAPNP_DEBUG Bjorn Helgaas
2007-08-15 16:32 ` [patch 5/6] PNP: remove MODULE infrastructure Bjorn Helgaas
2007-08-15 16:32 ` [patch 6/6] PNP: remove null pointer checks Bjorn Helgaas
2007-08-24 4:52 ` [patch 0/6] PNP: minor cleanups Len Brown
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).