public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DSPBRIDGE: Get rid of driver_minor global variable
@ 2010-02-01 18:18 Ameya Palande
  2010-02-01 19:48 ` Menon, Nishanth
  2010-02-06  1:58 ` Omar Ramirez Luna
  0 siblings, 2 replies; 5+ messages in thread
From: Ameya Palande @ 2010-02-01 18:18 UTC (permalink / raw)
  To: omar.ramirez; +Cc: nm, linux-omap, deepak.chitriki

Since there is only 1 device there is no need of driver_minor global variable.

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
---
 drivers/dsp/bridge/rmgr/drv_interface.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
index a02a32a..de79f26 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -93,7 +93,6 @@ static u32 driverContext;
 static char *GT_str;
 #endif /* CONFIG_BRIDGE_DEBUG */
 static s32 driver_major;
-static s32 driver_minor;
 static char *base_img;
 char *iva_img;
 static s32 shm_size = 0x500000;	/* 5 MB */
@@ -236,7 +235,7 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)
 	omap_dspbridge_dev = pdev;
 
 	/* use 2.6 device model */
-	result = alloc_chrdev_region(&dev, driver_minor, 1, driver_name);
+	result = alloc_chrdev_region(&dev, 0, 1, driver_name);
 	if (result < 0) {
 		GT_1trace(driverTrace, GT_7CLASS, "bridge_init: "
 				"Can't get Major %d \n", driver_major);
@@ -268,7 +267,7 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)
 		GT_0trace(driverTrace, GT_7CLASS,
 				"Error creating bridge class \n");
 
-	device_create(bridge_class, NULL, MKDEV(driver_major, driver_minor),
+	device_create(bridge_class, NULL, MKDEV(driver_major, 0),
 			NULL, "DspBridge");
 
 	GT_init();
@@ -428,7 +427,7 @@ func_cont:
 	SERVICES_Exit();
 	GT_exit();
 
-	devno = MKDEV(driver_major, driver_minor);
+	devno = MKDEV(driver_major, 0);
 	if (bridge_device) {
 		cdev_del(&bridge_device->cdev);
 		kfree(bridge_device);
@@ -436,7 +435,7 @@ func_cont:
 	unregister_chrdev_region(devno, 1);
 	if (bridge_class) {
 		/* remove the device from sysfs */
-		device_destroy(bridge_class, MKDEV(driver_major, driver_minor));
+		device_destroy(bridge_class, MKDEV(driver_major, 0));
 		class_destroy(bridge_class);
 
 	}
-- 
1.6.3.3


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

* Re: [PATCH] DSPBRIDGE: Get rid of driver_minor global variable
  2010-02-01 18:18 [PATCH] DSPBRIDGE: Get rid of driver_minor global variable Ameya Palande
@ 2010-02-01 19:48 ` Menon, Nishanth
  2010-02-02 10:03   ` Ameya Palande
  2010-02-06  1:58 ` Omar Ramirez Luna
  1 sibling, 1 reply; 5+ messages in thread
From: Menon, Nishanth @ 2010-02-01 19:48 UTC (permalink / raw)
  To: Ameya Palande
  Cc: Ramirez Luna, Omar, linux-omap@vger.kernel.org,
	Chitriki Rudramuni, Deepak

Ameya Palande said the following on 02/01/2010 08:18 PM:
> Since there is only 1 device there is no need of driver_minor global variable.
i am a little skeptical about this change - mainly coz, it might be a good idea for a userspace option
to be able to define what the minor id could be -> maybe an example could be /dev/mem which has a minor
id of 1, not 0. having a module_param might be better as such.. just my 2 cents..
> 
> Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
> ---
>  drivers/dsp/bridge/rmgr/drv_interface.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
> index a02a32a..de79f26 100644
> --- a/drivers/dsp/bridge/rmgr/drv_interface.c
> +++ b/drivers/dsp/bridge/rmgr/drv_interface.c
> @@ -93,7 +93,6 @@ static u32 driverContext;
>  static char *GT_str;
>  #endif /* CONFIG_BRIDGE_DEBUG */
>  static s32 driver_major;
> -static s32 driver_minor;
>  static char *base_img;
>  char *iva_img;
>  static s32 shm_size = 0x500000;	/* 5 MB */
> @@ -236,7 +235,7 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)
>  	omap_dspbridge_dev = pdev;
>  
>  	/* use 2.6 device model */
> -	result = alloc_chrdev_region(&dev, driver_minor, 1, driver_name);
> +	result = alloc_chrdev_region(&dev, 0, 1, driver_name);
>  	if (result < 0) {
>  		GT_1trace(driverTrace, GT_7CLASS, "bridge_init: "
>  				"Can't get Major %d \n", driver_major);
> @@ -268,7 +267,7 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev)
>  		GT_0trace(driverTrace, GT_7CLASS,
>  				"Error creating bridge class \n");
>  
> -	device_create(bridge_class, NULL, MKDEV(driver_major, driver_minor),
> +	device_create(bridge_class, NULL, MKDEV(driver_major, 0),
>  			NULL, "DspBridge");
>  
>  	GT_init();
> @@ -428,7 +427,7 @@ func_cont:
>  	SERVICES_Exit();
>  	GT_exit();
>  
> -	devno = MKDEV(driver_major, driver_minor);
> +	devno = MKDEV(driver_major, 0);
>  	if (bridge_device) {
>  		cdev_del(&bridge_device->cdev);
>  		kfree(bridge_device);
> @@ -436,7 +435,7 @@ func_cont:
>  	unregister_chrdev_region(devno, 1);
>  	if (bridge_class) {
>  		/* remove the device from sysfs */
> -		device_destroy(bridge_class, MKDEV(driver_major, driver_minor));
> +		device_destroy(bridge_class, MKDEV(driver_major, 0));
>  		class_destroy(bridge_class);
>  
>  	}

Regards,
Nishanth Menon

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

* Re: [PATCH] DSPBRIDGE: Get rid of driver_minor global variable
  2010-02-01 19:48 ` Menon, Nishanth
@ 2010-02-02 10:03   ` Ameya Palande
  2010-02-02 10:05     ` Menon, Nishanth
  0 siblings, 1 reply; 5+ messages in thread
From: Ameya Palande @ 2010-02-02 10:03 UTC (permalink / raw)
  To: nm@ti.com
  Cc: Ramirez Luna, Omar, linux-omap@vger.kernel.org,
	Chitriki Rudramuni, Deepak

Hi Nishanth,

On Mon, 2010-02-01 at 20:48 +0100, ext Menon, Nishanth wrote:
> Ameya Palande said the following on 02/01/2010 08:18 PM:
> > Since there is only 1 device there is no need of driver_minor global variable.
> i am a little skeptical about this change - mainly coz, it might be a good idea for a userspace option
> to be able to define what the minor id could be -> maybe an example could be /dev/mem which has a minor
> id of 1, not 0. having a module_param might be better as such.. just my 2 cents..

I do not agree with user space having control of defining minor id.
I would like to rephrase this sentence as: userspace should have control
of defining name (string) for the device file. I guess udev takes care
of that already!
 
Ideally userspace should just deal with device
names: /dev/device1, /dev/device2 etc. Why it interprets (and that way
creates a dependency on) major/minor number?

I am in favor of saving 4 bytes and less global namespace pollution :)

/dev/mem has minor id of 1 because it shares its major id with ramdisk.

file: include/linux/major.h

#define MEM_MAJOR               1
#define RAMDISK_MAJOR           1

Cheers,
Ameya.


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

* Re: [PATCH] DSPBRIDGE: Get rid of driver_minor global variable
  2010-02-02 10:03   ` Ameya Palande
@ 2010-02-02 10:05     ` Menon, Nishanth
  0 siblings, 0 replies; 5+ messages in thread
From: Menon, Nishanth @ 2010-02-02 10:05 UTC (permalink / raw)
  To: Ameya Palande
  Cc: Ramirez Luna, Omar, linux-omap@vger.kernel.org,
	Chitriki Rudramuni, Deepak

Ameya Palande said the following on 02/02/2010 12:03 PM:
> Hi Nishanth,
> 
> On Mon, 2010-02-01 at 20:48 +0100, ext Menon, Nishanth wrote:
>> Ameya Palande said the following on 02/01/2010 08:18 PM:
>>> Since there is only 1 device there is no need of driver_minor global variable.
>> i am a little skeptical about this change - mainly coz, it might be a good idea for a userspace option
>> to be able to define what the minor id could be -> maybe an example could be /dev/mem which has a minor
>> id of 1, not 0. having a module_param might be better as such.. just my 2 cents..
> 
> I do not agree with user space having control of defining minor id.
> I would like to rephrase this sentence as: userspace should have control
> of defining name (string) for the device file. I guess udev takes care
> of that already!
>  
> Ideally userspace should just deal with device
> names: /dev/device1, /dev/device2 etc. Why it interprets (and that way
> creates a dependency on) major/minor number?
> 
> I am in favor of saving 4 bytes and less global namespace pollution :)
> 
> /dev/mem has minor id of 1 because it shares its major id with ramdisk.
> 
> file: include/linux/major.h
> 
> #define MEM_MAJOR               1
> #define RAMDISK_MAJOR           1
> 
> Cheers,
> Ameya.
> 
ok ok ok. you have me convinced :D

/me slinks away to the corner of the room and sits on the chair facing 
the wall ;)

Regards,
Nishanth Menon

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

* Re: [PATCH] DSPBRIDGE: Get rid of driver_minor global variable
  2010-02-01 18:18 [PATCH] DSPBRIDGE: Get rid of driver_minor global variable Ameya Palande
  2010-02-01 19:48 ` Menon, Nishanth
@ 2010-02-06  1:58 ` Omar Ramirez Luna
  1 sibling, 0 replies; 5+ messages in thread
From: Omar Ramirez Luna @ 2010-02-06  1:58 UTC (permalink / raw)
  To: Ameya Palande
  Cc: Menon, Nishanth, linux-omap@vger.kernel.org,
	Chitriki Rudramuni, Deepak

On 2/1/2010 12:18 PM, Ameya Palande wrote:
> Since there is only 1 device there is no need of driver_minor global variable.
>
> Signed-off-by: Ameya Palande<ameya.palande@nokia.com>

Acked-by: Omar Ramirez Luna <omar.ramirez@ti.com>

Pushed to dspbridge

- omar

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

end of thread, other threads:[~2010-02-06  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-01 18:18 [PATCH] DSPBRIDGE: Get rid of driver_minor global variable Ameya Palande
2010-02-01 19:48 ` Menon, Nishanth
2010-02-02 10:03   ` Ameya Palande
2010-02-02 10:05     ` Menon, Nishanth
2010-02-06  1:58 ` Omar Ramirez Luna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox