linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (no subject)
@ 2009-06-20 19:45 Kay Sievers
  2009-06-21  9:04 ` Takashi Iwai
  2009-06-22 12:56 ` Re: David Woodhouse
  0 siblings, 2 replies; 9+ messages in thread
From: Kay Sievers @ 2009-06-20 19:45 UTC (permalink / raw)
  To: Greg KH, James Bottomley, Takashi Iwai, David S. Miller, David Woodhouse
  Cc: linux-kernel

The final piece of the driver core name limit. We are about to remove
BUS_ID_SIZE.

Some patches may still be in your queue. Just to make sure, we will
finish our task this time: David, David, James, Takashi, can you please
give an update, or take care of removing the last instances, or let me
know if you want a patch, or let us know, if we should just change it to
"20".

  $ find . -name "*.[ch]" | xargs grep '[^_]BUS_ID_SIZE'
  ./drivers/mtd/nand/txx9ndfmc.c:	char mtdname[BUS_ID_SIZE + 2];
  ./drivers/scsi/scsi_transport_fc.c:	char bsg_name[BUS_ID_SIZE]; /*20*/
  ./arch/sparc/kernel/vio.c:	if (strlen(bus_id_name) >= BUS_ID_SIZE - 4) {
  ./sound/soc/txx9/txx9aclc.c:	char devname[BUS_ID_SIZE + 2];

Thanks a lot,
Kay


From: Kay Sievers <kay.sievers@vrfy.org>
Subject: Driver Core: remove BUS_ID_SIZE

The name size limit is gone from the driver-core, this is
the removal of the last left-over.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
---
 include/linux/device.h |    2 --
 1 file changed, 2 deletions(-)

--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -25,8 +25,6 @@
 #include <asm/atomic.h>
 #include <asm/device.h>
 
-#define BUS_ID_SIZE		20
-
 struct device;
 struct device_private;
 struct device_driver;


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

* Re:
  2009-06-20 19:45 Kay Sievers
@ 2009-06-21  9:04 ` Takashi Iwai
  2009-06-22 12:56 ` Re: David Woodhouse
  1 sibling, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2009-06-21  9:04 UTC (permalink / raw)
  To: Kay Sievers
  Cc: Greg KH, James Bottomley, David S. Miller, David Woodhouse, linux-kernel

At Sat, 20 Jun 2009 21:45:24 +0200,
Kay Sievers wrote:
> 
> The final piece of the driver core name limit. We are about to remove
> BUS_ID_SIZE.
> 
> Some patches may still be in your queue. Just to make sure, we will
> finish our task this time: David, David, James, Takashi, can you please
> give an update, or take care of removing the last instances, or let me
> know if you want a patch, or let us know, if we should just change it to
> "20".

Yep, I'm going to send a pull request including the fix for this soon
later.


thanks,

Takashi

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

* Re:
  2009-06-20 19:45 Kay Sievers
  2009-06-21  9:04 ` Takashi Iwai
@ 2009-06-22 12:56 ` David Woodhouse
  2009-06-24  8:27   ` BUS_ID_SIZE is going away Kay Sievers
  1 sibling, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2009-06-22 12:56 UTC (permalink / raw)
  To: Kay Sievers
  Cc: Greg KH, James Bottomley, Takashi Iwai, David S. Miller, linux-kernel

On Sat, 2009-06-20 at 21:45 +0200, Kay Sievers wrote:
> The final piece of the driver core name limit. We are about to remove
> BUS_ID_SIZE.
> 
> Some patches may still be in your queue. Just to make sure, we will
> finish our task this time: David, David, James, Takashi, can you please
> give an update, or take care of removing the last instances, or let me
> know if you want a patch, or let us know, if we should just change it to
> "20".

I have this queued for 2.6.31 but have been on jury duty for the last 2
weeks so I'm hoping to get the pull request to Linus today now that I'm
free.

Was very unimpressed with the first version of the patch I saw, which
would have given me a potential buffer overflow if I'd just hard-coded
the buffer size AFAICT.

http://git.infradead.org/mtd-2.6.git?a=commitdiff;h=81933046

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: BUS_ID_SIZE is going away
  2009-06-22 12:56 ` Re: David Woodhouse
@ 2009-06-24  8:27   ` Kay Sievers
  2009-06-24 11:14     ` David Woodhouse
  0 siblings, 1 reply; 9+ messages in thread
From: Kay Sievers @ 2009-06-24  8:27 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Greg KH, James Bottomley, Takashi Iwai, David S. Miller, linux-kernel

On Mon, 2009-06-22 at 13:56 +0100, David Woodhouse wrote:
> I have this queued for 2.6.31 but have been on jury duty for the last 2
> weeks so I'm hoping to get the pull request to Linus today now that I'm
> free.

The old one is gone, but seems you merged a new one with BUS_ID_SIZE :)

  ./drivers/mtd/maps/integrator-flash.c:#define SUBDEV_NAME_SIZE	(BUS_ID_SIZE + 2)

Thanks,
Kay


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

* Re: BUS_ID_SIZE is going away
  2009-06-24  8:27   ` BUS_ID_SIZE is going away Kay Sievers
@ 2009-06-24 11:14     ` David Woodhouse
  2009-06-24 12:59       ` Catalin Marinas
  2009-06-28 11:47       ` Kay Sievers
  0 siblings, 2 replies; 9+ messages in thread
From: David Woodhouse @ 2009-06-24 11:14 UTC (permalink / raw)
  To: Kay Sievers, catalin.marinas
  Cc: Greg KH, James Bottomley, Takashi Iwai, David S. Miller,
	linux-kernel, linux-mtd

On Wed, 2009-06-24 at 10:27 +0200, Kay Sievers wrote:
> On Mon, 2009-06-22 at 13:56 +0100, David Woodhouse wrote:
> > I have this queued for 2.6.31 but have been on jury duty for the last 2
> > weeks so I'm hoping to get the pull request to Linus today now that I'm
> > free.
> 
> The old one is gone, but seems you merged a new one with BUS_ID_SIZE :)
> 
>   ./drivers/mtd/maps/integrator-flash.c:#define SUBDEV_NAME_SIZE	(BUS_ID_SIZE + 2)

Hm, true :)

Catalin, can you test the following? 

Btw, I'm unconvinced by the existing error handling -- if
armflash_subdev_probe() fails, it doesn't look like _that_ subdev
actually gets cleaned up in the loop at 'subdev_err:'. So we don't
release the memory region (and neither do we free the newly-kmalloced
name).

In fact, do we still need a separate platform device and driver for ARM
systems? What does it provide that the physmap driver does (and can)
not?

diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index b08a798..b9fac5b 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -42,10 +42,8 @@
 #include <mach/hardware.h>
 #include <asm/system.h>
 
-#define SUBDEV_NAME_SIZE	(BUS_ID_SIZE + 2)
-
 struct armflash_subdev_info {
-	char			name[SUBDEV_NAME_SIZE];
+	char			*name;
 	struct mtd_info		*mtd;
 	struct map_info		map;
 	struct flash_platform_data *plat;
@@ -134,6 +132,8 @@ static void armflash_subdev_remove(struct armflash_subdev_info *subdev)
 		map_destroy(subdev->mtd);
 	if (subdev->map.virt)
 		iounmap(subdev->map.virt);
+	kfree(subdev->name);
+	subdev->name = NULL;
 	release_mem_region(subdev->map.phys, subdev->map.size);
 }
 
@@ -177,11 +177,14 @@ static int armflash_probe(struct platform_device *dev)
 
 		if (nr == 1)
 			/* No MTD concatenation, just use the default name */
-			snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s",
-				 dev_name(&dev->dev));
+			subdev->name = kstrdup(dev_name(&dev->dev), GFP_KERNEL);
 		else
-			snprintf(subdev->name, SUBDEV_NAME_SIZE, "%s-%d",
-				 dev_name(&dev->dev), i);
+			subdev->name = kasprintf(GFP_KERNEL, "%s-%d",
+						 dev_name(&dev->dev), i);
+		if (!subdev->name) {
+			err = -ENOMEM;
+			break;
+		}
 		subdev->plat = plat;
 
 		err = armflash_subdev_probe(subdev, res);


-- 
dwmw2


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

* Re: BUS_ID_SIZE is going away
  2009-06-24 11:14     ` David Woodhouse
@ 2009-06-24 12:59       ` Catalin Marinas
  2009-06-24 14:09         ` David Woodhouse
  2009-06-28 11:47       ` Kay Sievers
  1 sibling, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2009-06-24 12:59 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Kay Sievers, Greg KH, James Bottomley, Takashi Iwai,
	David S. Miller, linux-kernel, linux-mtd, Russell King

On Wed, 2009-06-24 at 12:14 +0100, David Woodhouse wrote:
> On Wed, 2009-06-24 at 10:27 +0200, Kay Sievers wrote:
> > On Mon, 2009-06-22 at 13:56 +0100, David Woodhouse wrote:
> > > I have this queued for 2.6.31 but have been on jury duty for the last 2
> > > weeks so I'm hoping to get the pull request to Linus today now that I'm
> > > free.
> > 
> > The old one is gone, but seems you merged a new one with BUS_ID_SIZE :)
> > 
> >   ./drivers/mtd/maps/integrator-flash.c:#define SUBDEV_NAME_SIZE	(BUS_ID_SIZE + 2)
> 
> Hm, true :)
> 
> Catalin, can you test the following? 

Yes, it still works (with some remarks below).

> Btw, I'm unconvinced by the existing error handling -- if
> armflash_subdev_probe() fails, it doesn't look like _that_ subdev
> actually gets cleaned up in the loop at 'subdev_err:'. So we don't
> release the memory region (and neither do we free the newly-kmalloced
> name).

If armflash_subdev_probe() fails, it cleans up after itself so there is
no need to handle it in the subdev_err loop. With your patch, however,
this should be done explicitly if the subdev probing fails. Something
like below:

diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index b9fac5b..2aac41b 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -188,8 +188,11 @@ static int armflash_probe(struct platform_device *dev)
 		subdev->plat = plat;
 
 		err = armflash_subdev_probe(subdev, res);
-		if (err)
+		if (err) {
+			kfree(subdev->name);
+			subdev->name = NULL;
 			break;
+		}
 	}
 	info->nr_subdev = i;
 

> In fact, do we still need a separate platform device and driver for ARM
> systems? What does it provide that the physmap driver does (and can)
> not?

(I cc'ed Russell as well since he wrote the integrator-flash driver and
may have comments)

I gave physmap a quick try on RealView boards and it seems to work fine
with the patch below. The only difference is the AFS partition parsing
probes string, though this is no longer used on ARM Ltd platforms (some
old ones still use it).

I'll test it a bit more and, if there are no other comments, I'll push a
patch to convert the ARM Ltd platforms to physmap (but that's for the
next merging window as I don't think I have time to test it well enough
now).


RealView: Convert the platform code to use the physmap flash driver

From: Catalin Marinas <catalin.marinas@arm.com>

This platform was still using the integrator-flash driver but this
pretty much duplicates the physmap one.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/mach-realview/core.c |   31 ++++---------------------------
 1 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 0cc6f42..ef33872 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -30,6 +30,7 @@
 #include <linux/io.h>
 #include <linux/smsc911x.h>
 #include <linux/ata_platform.h>
+#include <linux/mtd/physmap.h>
 
 #include <asm/clkdev.h>
 #include <asm/system.h>
@@ -41,7 +42,6 @@
 #include <asm/hardware/icst307.h>
 
 #include <asm/mach/arch.h>
-#include <asm/mach/flash.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
 #include <asm/mach/mmc.h>
@@ -76,27 +76,7 @@ unsigned long long sched_clock(void)
 
 #define REALVIEW_FLASHCTRL    (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
 
-static int realview_flash_init(void)
-{
-	u32 val;
-
-	val = __raw_readl(REALVIEW_FLASHCTRL);
-	val &= ~REALVIEW_FLASHPROG_FLVPPEN;
-	__raw_writel(val, REALVIEW_FLASHCTRL);
-
-	return 0;
-}
-
-static void realview_flash_exit(void)
-{
-	u32 val;
-
-	val = __raw_readl(REALVIEW_FLASHCTRL);
-	val &= ~REALVIEW_FLASHPROG_FLVPPEN;
-	__raw_writel(val, REALVIEW_FLASHCTRL);
-}
-
-static void realview_flash_set_vpp(int on)
+static void realview_flash_set_vpp(struct map_info *map, int on)
 {
 	u32 val;
 
@@ -108,16 +88,13 @@ static void realview_flash_set_vpp(int on)
 	__raw_writel(val, REALVIEW_FLASHCTRL);
 }
 
-static struct flash_platform_data realview_flash_data = {
-	.map_name		= "cfi_probe",
+static struct physmap_flash_data realview_flash_data = {
 	.width			= 4,
-	.init			= realview_flash_init,
-	.exit			= realview_flash_exit,
 	.set_vpp		= realview_flash_set_vpp,
 };
 
 struct platform_device realview_flash_device = {
-	.name			= "armflash",
+	.name			= "physmap-flash",
 	.id			= 0,
 	.dev			= {
 		.platform_data	= &realview_flash_data,


-- 
Catalin


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

* Re: BUS_ID_SIZE is going away
  2009-06-24 12:59       ` Catalin Marinas
@ 2009-06-24 14:09         ` David Woodhouse
  2009-06-24 14:20           ` Catalin Marinas
  0 siblings, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2009-06-24 14:09 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Kay Sievers, Greg KH, James Bottomley, Takashi Iwai,
	David S. Miller, linux-kernel, linux-mtd, Russell King

On Wed, 2009-06-24 at 13:59 +0100, Catalin Marinas wrote:
> I gave physmap a quick try on RealView boards and it seems to work fine
> with the patch below. The only difference is the AFS partition parsing
> probes string, though this is no longer used on ARM Ltd platforms (some
> old ones still use it).

Perhaps we should add the list of partition types to the
physmap_flash_data?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: BUS_ID_SIZE is going away
  2009-06-24 14:09         ` David Woodhouse
@ 2009-06-24 14:20           ` Catalin Marinas
  0 siblings, 0 replies; 9+ messages in thread
From: Catalin Marinas @ 2009-06-24 14:20 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Kay Sievers, Greg KH, James Bottomley, Takashi Iwai,
	David S. Miller, linux-kernel, linux-mtd, Russell King

On Wed, 2009-06-24 at 15:09 +0100, David Woodhouse wrote:
> On Wed, 2009-06-24 at 13:59 +0100, Catalin Marinas wrote:
> > I gave physmap a quick try on RealView boards and it seems to work fine
> > with the patch below. The only difference is the AFS partition parsing
> > probes string, though this is no longer used on ARM Ltd platforms (some
> > old ones still use it).
> 
> Perhaps we should add the list of partition types to the
> physmap_flash_data?

I think this would make sense.

-- 
Catalin


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

* Re: BUS_ID_SIZE is going away
  2009-06-24 11:14     ` David Woodhouse
  2009-06-24 12:59       ` Catalin Marinas
@ 2009-06-28 11:47       ` Kay Sievers
  1 sibling, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2009-06-28 11:47 UTC (permalink / raw)
  To: David Woodhouse
  Cc: catalin.marinas, Greg KH, James Bottomley, Takashi Iwai,
	David S. Miller, linux-kernel, linux-mtd

On Wed, Jun 24, 2009 at 13:14, David Woodhouse<dwmw2@infradead.org> wrote:
> On Wed, 2009-06-24 at 10:27 +0200, Kay Sievers wrote:
>> On Mon, 2009-06-22 at 13:56 +0100, David Woodhouse wrote:
>> > I have this queued for 2.6.31 but have been on jury duty for the last 2
>> > weeks so I'm hoping to get the pull request to Linus today now that I'm
>> > free.
>>
>> The old one is gone, but seems you merged a new one with BUS_ID_SIZE :)
>>
>>   ./drivers/mtd/maps/integrator-flash.c:#define SUBDEV_NAME_SIZE      (BUS_ID_SIZE + 2)
>
> Hm, true :)

Seems, it's the last one left. In case the "real" fix you are working
on is not ready to apply, care to push out a change, so we can finally
get rid of itl? Or let me know, and we can replace it with "20" along
with the removal from the driver core.

Thanks,
Kay

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

end of thread, other threads:[~2009-06-28 11:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-20 19:45 Kay Sievers
2009-06-21  9:04 ` Takashi Iwai
2009-06-22 12:56 ` Re: David Woodhouse
2009-06-24  8:27   ` BUS_ID_SIZE is going away Kay Sievers
2009-06-24 11:14     ` David Woodhouse
2009-06-24 12:59       ` Catalin Marinas
2009-06-24 14:09         ` David Woodhouse
2009-06-24 14:20           ` Catalin Marinas
2009-06-28 11:47       ` Kay Sievers

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).