Re: [PATCH][RFC] drivers/firmware/dcdbas: rework to get uevents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mittwoch 14 November 2007 19:32:01, you (Frank Seidel) wrote:
> Hi,
> 
> this is a small trivial rework of the dcdbas driver so
> HAL can get uevents when platform devices are added or removed.

Sorry for the noise! In the meantime i realized (thanks to a nice
colleague) this isn't really necessary anymore since patch
43cc71eed1250755986da4c0f9898f9a635cb3bf is in mainline.

If you'd anyway to add this patch i gues this is a better version
of it.

Thanks,
Frank
---
Trivial little change to use new platform platform_register_device to
also get uevents on loading and unloading the driver (e.g. needed for HAL).

Signed-off-by: Frank Seidel <[email protected]>
---
 drivers/firmware/dcdbas.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -40,7 +40,7 @@
 #include "dcdbas.h"
 
 #define DRIVER_NAME		"dcdbas"
-#define DRIVER_VERSION		"5.6.0-3.2"
+#define DRIVER_VERSION		"5.6.0-3.3"
 #define DRIVER_DESCRIPTION	"Dell Systems Management Base Driver"
 
 static struct platform_device *dcdbas_pdev;
@@ -50,6 +50,7 @@ static dma_addr_t smi_data_buf_handle;
 static unsigned long smi_data_buf_size;
 static u32 smi_data_buf_phys_addr;
 static DEFINE_MUTEX(smi_data_lock);
+static char driver_name[] = DRIVER_NAME;
 
 static unsigned int host_control_action;
 static unsigned int host_control_smi_type;
@@ -596,6 +597,15 @@ static struct platform_driver dcdbas_dri
 	.remove		= __devexit_p(dcdbas_remove),
 };
 
+static void __devexit dcdbas_release(struct device *dev)
+{
+	struct platform_device *pd =
+			container_of(dev, struct platform_device, dev);
+
+	kfree(dev->platform_data);
+	kfree(pd->resource);
+}
+
 /**
  * dcdbas_init: initialize driver
  */
@@ -603,26 +613,27 @@ static int __init dcdbas_init(void)
 {
 	int error;
 
+	dcdbas_pdev = kmalloc(sizeof(*dcdbas_pdev), GFP_KERNEL);
+	if (!dcdbas_pdev)
+		return -ENOMEM;
+
 	error = platform_driver_register(&dcdbas_driver);
 	if (error)
-		return error;
+		goto err_malloc;
 
-	dcdbas_pdev = platform_device_alloc(DRIVER_NAME, -1);
-	if (!dcdbas_pdev) {
-		error = -ENOMEM;
-		goto err_unregister_driver;
-	}
-
-	error = platform_device_add(dcdbas_pdev);
+	dcdbas_pdev->name = driver_name;
+	dcdbas_pdev->id = -1;
+	dcdbas_pdev->dev.release = dcdbas_release;
+	error = platform_device_register(dcdbas_pdev);
 	if (error)
-		goto err_free_device;
+		goto err_unregister_driver;
 
 	return 0;
 
- err_free_device:
-	platform_device_put(dcdbas_pdev);
- err_unregister_driver:
+err_unregister_driver:
 	platform_driver_unregister(&dcdbas_driver);
+err_malloc:
+	kfree(dcdbas_pdev);
 	return error;
 }
 
@@ -647,6 +658,7 @@ static void __exit dcdbas_exit(void)
 	 * released.
 	 */
 	smi_data_buf_free();
+	kfree(dcdbas_pdev);
 }
 
 module_init(dcdbas_init);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux