ChangeSet 1.1587.12.85, 2004/05/11 14:44:02-07:00, eike-hotplug@sf-tec.de

[PATCH] CompactPCI: remove slot_paranoia_check and get_slot

slot_paranoia_check is only another kind of checking everything for NULL.
Removing this leads to function get_slot is reduced to a simple cast, so this
function can be killed also.

Eike


 drivers/pci/hotplug/cpci_hotplug_core.c |   41 +++-----------------------------
 1 files changed, 5 insertions(+), 36 deletions(-)


diff -Nru a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
--- a/drivers/pci/hotplug/cpci_hotplug_core.c	Mon May 17 16:57:19 2004
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c	Mon May 17 16:57:19 2004
@@ -81,37 +81,6 @@
 	.get_adapter_status = get_adapter_status,
 };
 
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int
-slot_paranoia_check(struct slot *slot, const char *function)
-{
-	if(!slot) {
-		dbg("%s - slot == NULL", function);
-		return -1;
-	}
-	if(!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!", function);
-		return -1;
-	}
-	return 0;
-}
-
-static inline struct slot *
-get_slot(struct hotplug_slot *hotplug_slot, const char *function)
-{
-	struct slot *slot;
-
-	if(!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL", function);
-		return NULL;
-	}
-
-	slot = (struct slot *) hotplug_slot->private;
-	if(slot_paranoia_check(slot, function))
-		return NULL;
-	return slot;
-}
-
 static int
 update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
 {
@@ -135,7 +104,7 @@
 static int
 enable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
 
 	dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
@@ -150,7 +119,7 @@
 static int
 disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
 
 	dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
@@ -201,7 +170,7 @@
 static int
 get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
 	*value = cpci_get_power_status(slot);
 	return 0;
@@ -210,7 +179,7 @@
 static int
 get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
 	*value = cpci_get_attention_status(slot);
 	return 0;
@@ -238,7 +207,7 @@
 
 static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
 	kfree(slot->hotplug_slot->info);
 	kfree(slot->hotplug_slot->name);
