mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] driver: allow register device with specific id
@ 2010-09-12 11:27 Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:27 ` [PATCH 2/4] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-12 11:27 UTC (permalink / raw)
  To: barebox

if you specify id = 0 the next available id will be taken
otherwise fail if already registered

before if you specify one it will have use the next free id anyway

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 lib/driver.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lib/driver.c b/lib/driver.c
index b600745..00aca9c 100644
--- a/lib/driver.c
+++ b/lib/driver.c
@@ -56,14 +56,24 @@ struct device_d *get_device_by_name(const char *name)
 	return NULL;
 }
 
+struct device_d *get_device_by_name_id(const char *name, int id)
+{
+	struct device_d *dev;
+
+	for_each_device(dev) {
+		if(!strcmp(dev->name, name) && id == dev->id)
+			return dev;
+	}
+
+	return NULL;
+}
+
 int get_free_deviceid(const char *name_template)
 {
 	int i = 0;
-	char name[MAX_DRIVER_NAME + 3];
 
 	while (1) {
-		sprintf(name, "%s%d", name_template, i);
-		if (!get_device_by_name(name))
+		if (!get_device_by_name_id(name_template, i))
 			return i;
 		i++;
 	};
@@ -95,7 +105,15 @@ int register_device(struct device_d *new_device)
 {
 	struct driver_d *drv;
 
-	new_device->id = get_free_deviceid(new_device->name);
+	if (new_device->id == 0) {
+		new_device->id = get_free_deviceid(new_device->name);
+	} else {
+		if (get_device_by_name_id(new_device->name, new_device->id)) {
+			eprintf("register_device: already registered %s\n",
+				dev_name(new_device));
+			return -EINVAL;
+		}
+	}
 
 	debug ("register_device: %s\n",new_device->name);
 
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/4] device: fix dev_name
  2010-09-12 11:27 [PATCH 1/4] driver: allow register device with specific id Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-12 11:27 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:27 ` [PATCH 3/4] amba-pl011: probe fail if we can get the clock Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-12 11:27 UTC (permalink / raw)
  To: barebox

dev_name is supposed to return the name of the device plus the id

currently we use %s%d format where in the kernel the use %s.%d
we may think to switch to this format for the device name and keeping the %s%d
for the devfs

this will be usefull to not modify the clock device name as example

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/driver.h |   12 +++++++-----
 lib/driver.c     |   14 ++++++--------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index ee0749d..ab1f850 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -25,7 +25,8 @@
 
 #include <linux/list.h>
 
-#define MAX_DRIVER_NAME 32
+#define MAX_DRIVER_NAME		32
+#define FORMAT_DRIVER_MANE_ID	"%s%d"
 
 #include <param.h>
 
@@ -176,9 +177,11 @@ int get_free_deviceid(const char *name_template);
 
 char *deviceid_from_spec_str(const char *str, char **endp);
 
+extern const char *dev_id(const struct device_d *dev);
+
 static inline const char *dev_name(const struct device_d *dev)
 {
-	return dev->name;
+	return dev_id(dev);
 }
 
 /* linear list over all available devices
@@ -239,11 +242,10 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f)
 }
 
 /* debugging and troubleshooting/diagnostic helpers. */
-extern const char *dev_id(const struct device_d *dev);
 
 #define dev_printf(dev, format, arg...)	\
-	printf("%s@%s: " format , dev_name(dev) , \
-	       dev_id(dev) , ## arg)
+	printf("%s@%s: " format , dev->name , \
+	       dev_name(dev) , ## arg)
 
 #define dev_emerg(dev, format, arg...)		\
 	dev_printf((dev) , format , ## arg)
diff --git a/lib/driver.c b/lib/driver.c
index 00aca9c..39881c2 100644
--- a/lib/driver.c
+++ b/lib/driver.c
@@ -45,11 +45,9 @@ static LIST_HEAD(active);
 struct device_d *get_device_by_name(const char *name)
 {
 	struct device_d *dev;
-	char devname[MAX_DRIVER_NAME + 3];
 
 	for_each_device(dev) {
-		sprintf(devname, "%s%d", dev->name, dev->id);
-		if(!strcmp(name, devname))
+		if(!strcmp(dev_name(dev), name))
 			return dev;
 	}
 
@@ -115,7 +113,7 @@ int register_device(struct device_d *new_device)
 		}
 	}
 
-	debug ("register_device: %s\n",new_device->name);
+	debug ("register_device: %s\n", dev_name(new_device));
 
 	if (!new_device->bus) {
 //		dev_err(new_device, "no bus type associated. Needs fixup\n");
@@ -138,7 +136,7 @@ EXPORT_SYMBOL(register_device);
 
 int unregister_device(struct device_d *old_dev)
 {
-	debug("unregister_device: %s:%s\n",old_dev->name, old_dev->id);
+	debug("unregister_device: %s\n", dev_name(old_dev));
 
 	if (!list_empty(&old_dev->children)) {
 		errno = -EBUSY;
@@ -182,7 +180,7 @@ struct driver_d *get_driver_by_name(const char *name)
 
 static void noinfo(struct device_d *dev)
 {
-	printf("no info available for %s\n", dev->name);
+	printf("no info available for %s\n", dev_name(dev));
 }
 
 static void noshortinfo(struct device_d *dev)
@@ -255,7 +253,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)
 	for (i = 0; i < depth; i++)
 		printf("|    ");
 
-	printf("%c----%s%d", edge, dev->name, dev->id);
+	printf("%c----%s", edge, dev_name(dev));
 	if (!list_empty(&dev->cdevs)) {
 		printf(" (");
 		list_for_each_entry(cdev, &dev->cdevs, devices_list) {
@@ -282,7 +280,7 @@ const char *dev_id(const struct device_d *dev)
 {
 	static char buf[sizeof(unsigned long) * 2];
 
-	sprintf(buf, "%s%d", dev->name, dev->id);
+	sprintf(buf, FORMAT_DRIVER_MANE_ID, dev->name, dev->id);
 
 	return buf;
 }
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/4] amba-pl011: probe fail if we can get the clock
  2010-09-12 11:27 [PATCH 1/4] driver: allow register device with specific id Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:27 ` [PATCH 2/4] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-12 11:27 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:38   ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-17 13:51   ` Sascha Hauer
  2010-09-12 11:27 ` [PATCH 4/4] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
  2010-09-17 13:45 ` [PATCH 1/4] driver: allow register device with specific id Sascha Hauer
  3 siblings, 2 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-12 11:27 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/serial/amba-pl011.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 07508d0..8ddba2e 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -34,6 +34,7 @@
 #include <asm/io.h>
 #include <linux/amba/serial.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 /*
  * We wrap our port structure around the generic console_device.
@@ -160,6 +161,9 @@ static int pl011_probe(struct device_d *dev)
 
 	uart->clk = clk_get(dev, NULL);
 
+	if (PTR_ERR(uart->clk) < 0)
+		return PTR_ERR(uart->clk);
+
 	cdev = &uart->uart;
 	dev->type_data = cdev;
 	cdev->dev = dev;
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/4] stm8815: fix the uart device clock match
  2010-09-12 11:27 [PATCH 1/4] driver: allow register device with specific id Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:27 ` [PATCH 2/4] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:27 ` [PATCH 3/4] amba-pl011: probe fail if we can get the clock Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-12 11:27 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-17 13:45 ` [PATCH 1/4] driver: allow register device with specific id Sascha Hauer
  3 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-12 11:27 UTC (permalink / raw)
  To: barebox

that use the device name + id to found it's clock
to use the right match as we fix the dev_name macro

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-nomadik/8815.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-nomadik/8815.c b/arch/arm/mach-nomadik/8815.c
index 8598f14..ca47672 100644
--- a/arch/arm/mach-nomadik/8815.c
+++ b/arch/arm/mach-nomadik/8815.c
@@ -50,12 +50,14 @@ void st8815_add_device_sdram(u32 size)
 }
 
 static struct device_d uart0_serial_device = {
+	.id = 0,
 	.name = "uart-pl011",
 	.map_base = NOMADIK_UART0_BASE,
 	.size = 4096,
 };
 
 static struct device_d uart1_serial_device = {
+	.id = 1,
 	.name = "uart-pl011",
 	.map_base = NOMADIK_UART1_BASE,
 	.size = 4096,
@@ -65,11 +67,11 @@ void st8815_register_uart(unsigned id)
 {
 	switch (id) {
 	case 0:
-		nmdk_clk_create(&st8815_clk_48, uart0_serial_device.name);
+		nmdk_clk_create(&st8815_clk_48, dev_name(&uart0_serial_device));
 		register_device(&uart0_serial_device);
 		break;
 	case 1:
-		nmdk_clk_create(&st8815_clk_48, uart1_serial_device.name);
+		nmdk_clk_create(&st8815_clk_48, dev_name(&uart1_serial_device));
 		register_device(&uart1_serial_device);
 		break;
 	}
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/4] amba-pl011: probe fail if we can get the clock
  2010-09-12 11:27 ` [PATCH 3/4] amba-pl011: probe fail if we can get the clock Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-12 11:38   ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-17 13:52     ` Sascha Hauer
  2010-09-17 13:51   ` Sascha Hauer
  1 sibling, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-12 11:38 UTC (permalink / raw)
  To: barebox

subject fix on git://git.jcrosoft.org/barebox.git sh-prepare

Best Regards,
J.
On 13:27 Sun 12 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/serial/amba-pl011.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
> index 07508d0..8ddba2e 100644
> --- a/drivers/serial/amba-pl011.c
> +++ b/drivers/serial/amba-pl011.c
> @@ -34,6 +34,7 @@
>  #include <asm/io.h>
>  #include <linux/amba/serial.h>
>  #include <linux/clk.h>
> +#include <linux/err.h>
>  
>  /*
>   * We wrap our port structure around the generic console_device.
> @@ -160,6 +161,9 @@ static int pl011_probe(struct device_d *dev)
>  
>  	uart->clk = clk_get(dev, NULL);
>  
> +	if (PTR_ERR(uart->clk) < 0)
> +		return PTR_ERR(uart->clk);
> +
>  	cdev = &uart->uart;
>  	dev->type_data = cdev;
>  	cdev->dev = dev;
> -- 
> 1.7.1

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] driver: allow register device with specific id
  2010-09-12 11:27 [PATCH 1/4] driver: allow register device with specific id Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2010-09-12 11:27 ` [PATCH 4/4] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-17 13:45 ` Sascha Hauer
  2010-09-17 13:50   ` Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2010-09-17 13:45 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi J,

On Sun, Sep 12, 2010 at 01:27:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> if you specify id = 0 the next available id will be taken
> otherwise fail if already registered

I think we need a better solution here. Being able to specify an id
is a good idea in general, but since 0 is a valid id we should be able
to specify exactly this id aswell.
An idea is to use -1 for a dynamic id, but of course this needs changes
to all existing devices.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] driver: allow register device with specific id
  2010-09-17 13:45 ` [PATCH 1/4] driver: allow register device with specific id Sascha Hauer
@ 2010-09-17 13:50   ` Jean-Christophe PLAGNIOL-VILLARD
  2010-09-17 13:54     ` Sascha Hauer
  0 siblings, 1 reply; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-17 13:50 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:45 Fri 17 Sep     , Sascha Hauer wrote:
> Hi J,
> 
> On Sun, Sep 12, 2010 at 01:27:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > if you specify id = 0 the next available id will be taken
> > otherwise fail if already registered
> 
> I think we need a better solution here. Being able to specify an id
> is a good idea in general, but since 0 is a valid id we should be able
> to specify exactly this id aswell.
> An idea is to use -1 for a dynamic id, but of course this needs changes
> to all existing devices.
I prefer to do it a second step
in this case

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/4] amba-pl011: probe fail if we can get the clock
  2010-09-12 11:27 ` [PATCH 3/4] amba-pl011: probe fail if we can get the clock Jean-Christophe PLAGNIOL-VILLARD
  2010-09-12 11:38   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-17 13:51   ` Sascha Hauer
  2010-09-17 13:54     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2010-09-17 13:51 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi J,

The subject should be '...fail if we can *not* get the clock'.

On Sun, Sep 12, 2010 at 01:27:39PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/serial/amba-pl011.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
> index 07508d0..8ddba2e 100644
> --- a/drivers/serial/amba-pl011.c
> +++ b/drivers/serial/amba-pl011.c
> @@ -34,6 +34,7 @@
>  #include <asm/io.h>
>  #include <linux/amba/serial.h>
>  #include <linux/clk.h>
> +#include <linux/err.h>
>  
>  /*
>   * We wrap our port structure around the generic console_device.
> @@ -160,6 +161,9 @@ static int pl011_probe(struct device_d *dev)
>  
>  	uart->clk = clk_get(dev, NULL);
>  
> +	if (PTR_ERR(uart->clk) < 0)

We have the IS_ERR macro for testing. PTR_ERR is wrong here because it
only casts the pointer to long, so the condition above is true for every
pointer > 0x80000000.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/4] amba-pl011: probe fail if we can get the clock
  2010-09-12 11:38   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-17 13:52     ` Sascha Hauer
  0 siblings, 0 replies; 12+ messages in thread
From: Sascha Hauer @ 2010-09-17 13:52 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Sep 12, 2010 at 01:38:30PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> subject fix on git://git.jcrosoft.org/barebox.git sh-prepare

Naa, should have read this first before answering the last mail.


> 
> Best Regards,
> J.
> On 13:27 Sun 12 Sep     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/serial/amba-pl011.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
> > index 07508d0..8ddba2e 100644
> > --- a/drivers/serial/amba-pl011.c
> > +++ b/drivers/serial/amba-pl011.c
> > @@ -34,6 +34,7 @@
> >  #include <asm/io.h>
> >  #include <linux/amba/serial.h>
> >  #include <linux/clk.h>
> > +#include <linux/err.h>
> >  
> >  /*
> >   * We wrap our port structure around the generic console_device.
> > @@ -160,6 +161,9 @@ static int pl011_probe(struct device_d *dev)
> >  
> >  	uart->clk = clk_get(dev, NULL);
> >  
> > +	if (PTR_ERR(uart->clk) < 0)
> > +		return PTR_ERR(uart->clk);
> > +
> >  	cdev = &uart->uart;
> >  	dev->type_data = cdev;
> >  	cdev->dev = dev;
> > -- 
> > 1.7.1
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] driver: allow register device with specific id
  2010-09-17 13:50   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-09-17 13:54     ` Sascha Hauer
  2010-09-17 13:55       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2010-09-17 13:54 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Sep 17, 2010 at 03:50:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:45 Fri 17 Sep     , Sascha Hauer wrote:
> > Hi J,
> > 
> > On Sun, Sep 12, 2010 at 01:27:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > if you specify id = 0 the next available id will be taken
> > > otherwise fail if already registered
> > 
> > I think we need a better solution here. Being able to specify an id
> > is a good idea in general, but since 0 is a valid id we should be able
> > to specify exactly this id aswell.
> > An idea is to use -1 for a dynamic id, but of course this needs changes
> > to all existing devices.
> I prefer to do it a second step
> in this case

I prefer doing it first, because it makes sure the problem is getting
solved.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 3/4] amba-pl011: probe fail if we can get the clock
  2010-09-17 13:51   ` Sascha Hauer
@ 2010-09-17 13:54     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-17 13:54 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:51 Fri 17 Sep     , Sascha Hauer wrote:
> Hi J,
> 
> The subject should be '...fail if we can *not* get the clock'.
yeah it's fix inthe pull request
> 
> On Sun, Sep 12, 2010 at 01:27:39PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/serial/amba-pl011.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
> > index 07508d0..8ddba2e 100644
> > --- a/drivers/serial/amba-pl011.c
> > +++ b/drivers/serial/amba-pl011.c
> > @@ -34,6 +34,7 @@
> >  #include <asm/io.h>
> >  #include <linux/amba/serial.h>
> >  #include <linux/clk.h>
> > +#include <linux/err.h>
> >  
> >  /*
> >   * We wrap our port structure around the generic console_device.
> > @@ -160,6 +161,9 @@ static int pl011_probe(struct device_d *dev)
> >  
> >  	uart->clk = clk_get(dev, NULL);
> >  
> > +	if (PTR_ERR(uart->clk) < 0)
> 
> We have the IS_ERR macro for testing. PTR_ERR is wrong here because it
> only casts the pointer to long, so the condition above is true for every
> pointer > 0x80000000.
too

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] driver: allow register device with specific id
  2010-09-17 13:54     ` Sascha Hauer
@ 2010-09-17 13:55       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 12+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-09-17 13:55 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 15:54 Fri 17 Sep     , Sascha Hauer wrote:
> On Fri, Sep 17, 2010 at 03:50:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 15:45 Fri 17 Sep     , Sascha Hauer wrote:
> > > Hi J,
> > > 
> > > On Sun, Sep 12, 2010 at 01:27:37PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > if you specify id = 0 the next available id will be taken
> > > > otherwise fail if already registered
> > > 
> > > I think we need a better solution here. Being able to specify an id
> > > is a good idea in general, but since 0 is a valid id we should be able
> > > to specify exactly this id aswell.
> > > An idea is to use -1 for a dynamic id, but of course this needs changes
> > > to all existing devices.
> > I prefer to do it a second step
> > in this case
> 
> I prefer doing it first, because it makes sure the problem is getting
> solved.
I prefer to do a second incremental patch

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2010-09-17 13:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-12 11:27 [PATCH 1/4] driver: allow register device with specific id Jean-Christophe PLAGNIOL-VILLARD
2010-09-12 11:27 ` [PATCH 2/4] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
2010-09-12 11:27 ` [PATCH 3/4] amba-pl011: probe fail if we can get the clock Jean-Christophe PLAGNIOL-VILLARD
2010-09-12 11:38   ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-17 13:52     ` Sascha Hauer
2010-09-17 13:51   ` Sascha Hauer
2010-09-17 13:54     ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-12 11:27 ` [PATCH 4/4] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
2010-09-17 13:45 ` [PATCH 1/4] driver: allow register device with specific id Sascha Hauer
2010-09-17 13:50   ` Jean-Christophe PLAGNIOL-VILLARD
2010-09-17 13:54     ` Sascha Hauer
2010-09-17 13:55       ` Jean-Christophe PLAGNIOL-VILLARD

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