linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: fbtft: use strncpy instead of strcpy
@ 2015-09-05 13:43 Sudip Mukherjee
  2015-09-05 13:43 ` [PATCH 2/3] staging: fbtft: do not use magic numbers Sudip Mukherjee
  2015-09-05 13:43 ` [PATCH 3/3] staging: fbtft: use pr_fmt Sudip Mukherjee
  0 siblings, 2 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-09-05 13:43 UTC (permalink / raw)
  To: Thomas Petazzoni, Noralf Trønnes, Greg Kroah-Hartman
  Cc: linux-kernel, devel, Sudip Mukherjee

Using strcpy() is a security risk as the destination buffer size is not
checked and we may over-run the buffer. Use strncpy() instead, while
mentioning the buffer size leaving place for the NULL termination.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/fbtft/fbtft_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 0483d33..3856c88 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -1342,7 +1342,8 @@ static int __init fbtft_device_init(void)
 				p_name, p_num);
 			return -EINVAL;
 		}
-		strcpy(fbtft_device_param_gpios[i].name, p_name);
+		strncpy(fbtft_device_param_gpios[i].name, p_name,
+			FBTFT_GPIO_NAME_SIZE - 1);
 		fbtft_device_param_gpios[i++].gpio = (int) val;
 		if (i == MAX_GPIOS) {
 			pr_err(DRVNAME
-- 
1.9.1


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

* [PATCH 2/3] staging: fbtft: do not use magic numbers
  2015-09-05 13:43 [PATCH 1/3] staging: fbtft: use strncpy instead of strcpy Sudip Mukherjee
@ 2015-09-05 13:43 ` Sudip Mukherjee
  2015-09-05 13:43 ` [PATCH 3/3] staging: fbtft: use pr_fmt Sudip Mukherjee
  1 sibling, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-09-05 13:43 UTC (permalink / raw)
  To: Thomas Petazzoni, Noralf Trønnes, Greg Kroah-Hartman
  Cc: linux-kernel, devel, Sudip Mukherjee

Using magic numbers are not good coding practise. Use
FBTFT_GPIO_NAME_SIZE as defined in the header files.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/fbtft/fbtft_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 3856c88..80ab918 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -1375,7 +1375,7 @@ static int __init fbtft_device_init(void)
 	}
 
 	/* name=list lists all supported displays */
-	if (strncmp(name, "list", 32) == 0) {
+	if (strncmp(name, "list", FBTFT_GPIO_NAME_SIZE) == 0) {
 		pr_info(DRVNAME":  Supported displays:\n");
 
 		for (i = 0; i < ARRAY_SIZE(displays); i++)
-- 
1.9.1


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

* [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-05 13:43 [PATCH 1/3] staging: fbtft: use strncpy instead of strcpy Sudip Mukherjee
  2015-09-05 13:43 ` [PATCH 2/3] staging: fbtft: do not use magic numbers Sudip Mukherjee
@ 2015-09-05 13:43 ` Sudip Mukherjee
  2015-09-09 18:35   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2015-09-05 13:43 UTC (permalink / raw)
  To: Thomas Petazzoni, Noralf Trønnes, Greg Kroah-Hartman
  Cc: linux-kernel, devel, Sudip Mukherjee

Instead of defining DRVNAME and using it in all calls to pr_* family of
macros lets start using pr_fmt.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
 1 file changed, 35 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 80ab918..029423e 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#define pr_fmt(fmt) "fbtft_device: " fmt
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -21,8 +22,6 @@
 
 #include "fbtft.h"
 
-#define DRVNAME "fbtft_device"
-
 #define MAX_GPIOS 32
 
 static struct spi_device *spi_device;
@@ -1215,16 +1214,16 @@ static int spi_device_found(struct device *dev, void *data)
 {
 	struct spi_device *spi = container_of(dev, struct spi_device, dev);
 
-	pr_info(DRVNAME":      %s %s %dkHz %d bits mode=0x%02X\n",
-		spi->modalias, dev_name(dev), spi->max_speed_hz / 1000,
-		spi->bits_per_word, spi->mode);
+	pr_info("%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias,
+		dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word,
+		spi->mode);
 
 	return 0;
 }
 
 static void pr_spi_devices(void)
 {
-	pr_info(DRVNAME":  SPI devices registered:\n");
+	pr_info("SPI devices registered:\n");
 	bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found);
 }
 
@@ -1234,16 +1233,15 @@ static int p_device_found(struct device *dev, void *data)
 	*pdev = container_of(dev, struct platform_device, dev);
 
 	if (strstr(pdev->name, "fb"))
-		pr_info(DRVNAME":      %s id=%d pdata? %s\n",
-				pdev->name, pdev->id,
-				pdev->dev.platform_data ? "yes" : "no");
+		pr_info("%s id=%d pdata? %s\n", pdev->name, pdev->id,
+			pdev->dev.platform_data ? "yes" : "no");
 
 	return 0;
 }
 
 static void pr_p_devices(void)
 {
-	pr_info(DRVNAME":  'fb' Platform devices registered:\n");
+	pr_info("'fb' Platform devices registered:\n");
 	bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found);
 }
 
@@ -1258,7 +1256,7 @@ static void fbtft_device_spi_delete(struct spi_master *master, unsigned cs)
 	dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
 	if (dev) {
 		if (verbose)
-			pr_info(DRVNAME": Deleting %s\n", str);
+			pr_info("Deleting %s\n", str);
 		device_del(dev);
 	}
 }
@@ -1269,7 +1267,7 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi)
 
 	master = spi_busnum_to_master(spi->bus_num);
 	if (!master) {
-		pr_err(DRVNAME ":  spi_busnum_to_master(%d) returned NULL\n",
+		pr_err("spi_busnum_to_master(%d) returned NULL\n",
 								spi->bus_num);
 		return -EINVAL;
 	}
@@ -1278,7 +1276,7 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi)
 	spi_device = spi_new_device(master, spi);
 	put_device(&master->dev);
 	if (!spi_device) {
-		pr_err(DRVNAME ":    spi_new_device() returned NULL\n");
+		pr_err("spi_new_device() returned NULL\n");
 		return -EPERM;
 	}
 	return 0;
@@ -1301,11 +1299,11 @@ static int __init fbtft_device_init(void)
 	long val;
 	int ret = 0;
 
-	pr_debug("\n\n"DRVNAME": init\n");
+	pr_debug("init\n");
 
 	if (name == NULL) {
 #ifdef MODULE
-		pr_err(DRVNAME":  missing module parameter: 'name'\n");
+		pr_err("missing module parameter: 'name'\n");
 		return -EINVAL;
 #else
 		return 0;
@@ -1313,42 +1311,37 @@ static int __init fbtft_device_init(void)
 	}
 
 	if (init_num > FBTFT_MAX_INIT_SEQUENCE) {
-		pr_err(DRVNAME
-			":  init parameter: exceeded max array size: %d\n",
-			FBTFT_MAX_INIT_SEQUENCE);
+		pr_err("init parameter: exceeded max array size: %d\n",
+		       FBTFT_MAX_INIT_SEQUENCE);
 		return -EINVAL;
 	}
 
 	/* parse module parameter: gpios */
 	while ((p_gpio = strsep(&gpios, ","))) {
 		if (strchr(p_gpio, ':') == NULL) {
-			pr_err(DRVNAME
-				":  error: missing ':' in gpios parameter: %s\n",
-				p_gpio);
+			pr_err("error: missing ':' in gpios parameter: %s\n",
+			       p_gpio);
 			return -EINVAL;
 		}
 		p_num = p_gpio;
 		p_name = strsep(&p_num, ":");
 		if (p_name == NULL || p_num == NULL) {
-			pr_err(DRVNAME
-				":  something bad happened parsing gpios parameter: %s\n",
-				p_gpio);
+			pr_err("something bad happened parsing gpios parameter: %s\n",
+			       p_gpio);
 			return -EINVAL;
 		}
 		ret = kstrtol(p_num, 10, &val);
 		if (ret) {
-			pr_err(DRVNAME
-				":  could not parse number in gpios parameter: %s:%s\n",
-				p_name, p_num);
+			pr_err("could not parse number in gpios parameter: %s:%s\n",
+			       p_name, p_num);
 			return -EINVAL;
 		}
 		strncpy(fbtft_device_param_gpios[i].name, p_name,
 			FBTFT_GPIO_NAME_SIZE - 1);
 		fbtft_device_param_gpios[i++].gpio = (int) val;
 		if (i == MAX_GPIOS) {
-			pr_err(DRVNAME
-				":  gpios parameter: exceeded max array size: %d\n",
-				MAX_GPIOS);
+			pr_err("gpios parameter: exceeded max array size: %d\n",
+			       MAX_GPIOS);
 			return -EINVAL;
 		}
 	}
@@ -1361,7 +1354,7 @@ static int __init fbtft_device_init(void)
 	if (verbose > 2)
 		pr_p_devices(); /* print list of 'fb' platform devices */
 
-	pr_debug(DRVNAME":  name='%s', busnum=%d, cs=%d\n", name, busnum, cs);
+	pr_debug("name='%s', busnum=%d, cs=%d\n", name, busnum, cs);
 
 	if (rotate > 0 && rotate < 4) {
 		rotate = (4 - rotate) * 90;
@@ -1376,10 +1369,10 @@ static int __init fbtft_device_init(void)
 
 	/* name=list lists all supported displays */
 	if (strncmp(name, "list", FBTFT_GPIO_NAME_SIZE) == 0) {
-		pr_info(DRVNAME":  Supported displays:\n");
+		pr_info("Supported displays:\n");
 
 		for (i = 0; i < ARRAY_SIZE(displays); i++)
-			pr_info(DRVNAME":      %s\n", displays[i].name);
+			pr_info("%s\n", displays[i].name);
 		return -ECANCELED;
 	}
 
@@ -1410,7 +1403,7 @@ static int __init fbtft_device_init(void)
 				p_device = displays[i].pdev;
 				pdata = p_device->dev.platform_data;
 			} else {
-				pr_err(DRVNAME": broken displays array\n");
+				pr_err("broken displays array\n");
 				return -EINVAL;
 			}
 
@@ -1442,16 +1435,14 @@ static int __init fbtft_device_init(void)
 			if (displays[i].spi) {
 				ret = fbtft_device_spi_device_register(spi);
 				if (ret) {
-					pr_err(DRVNAME
-						": failed to register SPI device\n");
+					pr_err("failed to register SPI device\n");
 					return ret;
 				}
 			} else {
 				ret = platform_device_register(p_device);
 				if (ret < 0) {
-					pr_err(DRVNAME
-						":    platform_device_register() returned %d\n",
-						ret);
+					pr_err("platform_device_register() returned %d\n",
+					       ret);
 					return ret;
 				}
 			}
@@ -1461,22 +1452,22 @@ static int __init fbtft_device_init(void)
 	}
 
 	if (!found) {
-		pr_err(DRVNAME":  display not supported: '%s'\n", name);
+		pr_err("display not supported: '%s'\n", name);
 		return -EINVAL;
 	}
 
 	if (verbose && pdata && pdata->gpios) {
 		gpio = pdata->gpios;
-		pr_info(DRVNAME":  GPIOS used by '%s':\n", name);
+		pr_info("GPIOS used by '%s':\n", name);
 		found = false;
 		while (verbose && gpio->name[0]) {
-			pr_info(DRVNAME":    '%s' = GPIO%d\n",
+			pr_info("'%s' = GPIO%d\n",
 				gpio->name, gpio->gpio);
 			gpio++;
 			found = true;
 		}
 		if (!found)
-			pr_info(DRVNAME":    (none)\n");
+			pr_info("(none)\n");
 	}
 
 	if (spi_device && (verbose > 1))
@@ -1489,7 +1480,7 @@ static int __init fbtft_device_init(void)
 
 static void __exit fbtft_device_exit(void)
 {
-	pr_debug(DRVNAME" - exit\n");
+	pr_debug("exit\n");
 
 	if (spi_device) {
 		device_del(&spi_device->dev);
-- 
1.9.1


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

* Re: [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-05 13:43 ` [PATCH 3/3] staging: fbtft: use pr_fmt Sudip Mukherjee
@ 2015-09-09 18:35   ` Greg Kroah-Hartman
  2015-09-09 21:20     ` Noralf Trønnes
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2015-09-09 18:35 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Thomas Petazzoni, Noralf Trønnes, devel, linux-kernel

On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote:
> Instead of defining DRVNAME and using it in all calls to pr_* family of
> macros lets start using pr_fmt.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
>  1 file changed, 35 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
> index 80ab918..029423e 100644
> --- a/drivers/staging/fbtft/fbtft_device.c
> +++ b/drivers/staging/fbtft/fbtft_device.c
> @@ -13,6 +13,7 @@
>   * GNU General Public License for more details.
>   */
>  
> +#define pr_fmt(fmt) "fbtft_device: " fmt
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/init.h>
> @@ -21,8 +22,6 @@
>  
>  #include "fbtft.h"
>  
> -#define DRVNAME "fbtft_device"
> -
>  #define MAX_GPIOS 32
>  
>  static struct spi_device *spi_device;
> @@ -1215,16 +1214,16 @@ static int spi_device_found(struct device *dev, void *data)
>  {
>  	struct spi_device *spi = container_of(dev, struct spi_device, dev);
>  
> -	pr_info(DRVNAME":      %s %s %dkHz %d bits mode=0x%02X\n",
> -		spi->modalias, dev_name(dev), spi->max_speed_hz / 1000,
> -		spi->bits_per_word, spi->mode);
> +	pr_info("%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias,
> +		dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word,
> +		spi->mode);

This should be dev_info().

>  
>  	return 0;
>  }
>  
>  static void pr_spi_devices(void)
>  {
> -	pr_info(DRVNAME":  SPI devices registered:\n");
> +	pr_info("SPI devices registered:\n");

Don't be noisy, this shouldn't be here at all.  Or maybe pr_debug() if
you really need it.

>  	bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found);
>  }
>  
> @@ -1234,16 +1233,15 @@ static int p_device_found(struct device *dev, void *data)
>  	*pdev = container_of(dev, struct platform_device, dev);
>  
>  	if (strstr(pdev->name, "fb"))
> -		pr_info(DRVNAME":      %s id=%d pdata? %s\n",
> -				pdev->name, pdev->id,
> -				pdev->dev.platform_data ? "yes" : "no");
> +		pr_info("%s id=%d pdata? %s\n", pdev->name, pdev->id,
> +			pdev->dev.platform_data ? "yes" : "no");

dev_info()


>  
>  	return 0;
>  }
>  
>  static void pr_p_devices(void)
>  {
> -	pr_info(DRVNAME":  'fb' Platform devices registered:\n");
> +	pr_info("'fb' Platform devices registered:\n");

pr_debug

>  	bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found);
>  }
>  
> @@ -1258,7 +1256,7 @@ static void fbtft_device_spi_delete(struct spi_master *master, unsigned cs)
>  	dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
>  	if (dev) {
>  		if (verbose)
> -			pr_info(DRVNAME": Deleting %s\n", str);
> +			pr_info("Deleting %s\n", str);

dev_debug()

>  		device_del(dev);
>  	}
>  }
> @@ -1269,7 +1267,7 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi)
>  
>  	master = spi_busnum_to_master(spi->bus_num);
>  	if (!master) {
> -		pr_err(DRVNAME ":  spi_busnum_to_master(%d) returned NULL\n",
> +		pr_err("spi_busnum_to_master(%d) returned NULL\n",
>  								spi->bus_num);

dev_err()

>  		return -EINVAL;
>  	}
> @@ -1278,7 +1276,7 @@ static int fbtft_device_spi_device_register(struct spi_board_info *spi)
>  	spi_device = spi_new_device(master, spi);
>  	put_device(&master->dev);
>  	if (!spi_device) {
> -		pr_err(DRVNAME ":    spi_new_device() returned NULL\n");
> +		pr_err("spi_new_device() returned NULL\n");

dev_err()

>  		return -EPERM;
>  	}
>  	return 0;
> @@ -1301,11 +1299,11 @@ static int __init fbtft_device_init(void)
>  	long val;
>  	int ret = 0;
>  
> -	pr_debug("\n\n"DRVNAME": init\n");
> +	pr_debug("init\n");

Just delete this.

>  
>  	if (name == NULL) {
>  #ifdef MODULE
> -		pr_err(DRVNAME":  missing module parameter: 'name'\n");
> +		pr_err("missing module parameter: 'name'\n");
>  		return -EINVAL;
>  #else
>  		return 0;
> @@ -1313,42 +1311,37 @@ static int __init fbtft_device_init(void)
>  	}
>  
>  	if (init_num > FBTFT_MAX_INIT_SEQUENCE) {
> -		pr_err(DRVNAME
> -			":  init parameter: exceeded max array size: %d\n",
> -			FBTFT_MAX_INIT_SEQUENCE);
> +		pr_err("init parameter: exceeded max array size: %d\n",
> +		       FBTFT_MAX_INIT_SEQUENCE);
>  		return -EINVAL;
>  	}
>  
>  	/* parse module parameter: gpios */
>  	while ((p_gpio = strsep(&gpios, ","))) {
>  		if (strchr(p_gpio, ':') == NULL) {
> -			pr_err(DRVNAME
> -				":  error: missing ':' in gpios parameter: %s\n",
> -				p_gpio);
> +			pr_err("error: missing ':' in gpios parameter: %s\n",
> +			       p_gpio);
>  			return -EINVAL;
>  		}
>  		p_num = p_gpio;
>  		p_name = strsep(&p_num, ":");
>  		if (p_name == NULL || p_num == NULL) {
> -			pr_err(DRVNAME
> -				":  something bad happened parsing gpios parameter: %s\n",
> -				p_gpio);
> +			pr_err("something bad happened parsing gpios parameter: %s\n",
> +			       p_gpio);
>  			return -EINVAL;
>  		}
>  		ret = kstrtol(p_num, 10, &val);
>  		if (ret) {
> -			pr_err(DRVNAME
> -				":  could not parse number in gpios parameter: %s:%s\n",
> -				p_name, p_num);
> +			pr_err("could not parse number in gpios parameter: %s:%s\n",
> +			       p_name, p_num);
>  			return -EINVAL;
>  		}
>  		strncpy(fbtft_device_param_gpios[i].name, p_name,
>  			FBTFT_GPIO_NAME_SIZE - 1);
>  		fbtft_device_param_gpios[i++].gpio = (int) val;
>  		if (i == MAX_GPIOS) {
> -			pr_err(DRVNAME
> -				":  gpios parameter: exceeded max array size: %d\n",
> -				MAX_GPIOS);
> +			pr_err("gpios parameter: exceeded max array size: %d\n",
> +			       MAX_GPIOS);
>  			return -EINVAL;
>  		}
>  	}
> @@ -1361,7 +1354,7 @@ static int __init fbtft_device_init(void)
>  	if (verbose > 2)
>  		pr_p_devices(); /* print list of 'fb' platform devices */
>  
> -	pr_debug(DRVNAME":  name='%s', busnum=%d, cs=%d\n", name, busnum, cs);
> +	pr_debug("name='%s', busnum=%d, cs=%d\n", name, busnum, cs);
>  
>  	if (rotate > 0 && rotate < 4) {
>  		rotate = (4 - rotate) * 90;
> @@ -1376,10 +1369,10 @@ static int __init fbtft_device_init(void)
>  
>  	/* name=list lists all supported displays */
>  	if (strncmp(name, "list", FBTFT_GPIO_NAME_SIZE) == 0) {
> -		pr_info(DRVNAME":  Supported displays:\n");
> +		pr_info("Supported displays:\n");
>  
>  		for (i = 0; i < ARRAY_SIZE(displays); i++)
> -			pr_info(DRVNAME":      %s\n", displays[i].name);
> +			pr_info("%s\n", displays[i].name);
>  		return -ECANCELED;
>  	}
>  
> @@ -1410,7 +1403,7 @@ static int __init fbtft_device_init(void)
>  				p_device = displays[i].pdev;
>  				pdata = p_device->dev.platform_data;
>  			} else {
> -				pr_err(DRVNAME": broken displays array\n");
> +				pr_err("broken displays array\n");
>  				return -EINVAL;
>  			}
>  
> @@ -1442,16 +1435,14 @@ static int __init fbtft_device_init(void)
>  			if (displays[i].spi) {
>  				ret = fbtft_device_spi_device_register(spi);
>  				if (ret) {
> -					pr_err(DRVNAME
> -						": failed to register SPI device\n");
> +					pr_err("failed to register SPI device\n");
>  					return ret;
>  				}
>  			} else {
>  				ret = platform_device_register(p_device);
>  				if (ret < 0) {
> -					pr_err(DRVNAME
> -						":    platform_device_register() returned %d\n",
> -						ret);
> +					pr_err("platform_device_register() returned %d\n",
> +					       ret);
>  					return ret;
>  				}
>  			}
> @@ -1461,22 +1452,22 @@ static int __init fbtft_device_init(void)
>  	}
>  
>  	if (!found) {
> -		pr_err(DRVNAME":  display not supported: '%s'\n", name);
> +		pr_err("display not supported: '%s'\n", name);
>  		return -EINVAL;
>  	}
>  
>  	if (verbose && pdata && pdata->gpios) {
>  		gpio = pdata->gpios;
> -		pr_info(DRVNAME":  GPIOS used by '%s':\n", name);
> +		pr_info("GPIOS used by '%s':\n", name);
>  		found = false;
>  		while (verbose && gpio->name[0]) {
> -			pr_info(DRVNAME":    '%s' = GPIO%d\n",
> +			pr_info("'%s' = GPIO%d\n",
>  				gpio->name, gpio->gpio);
>  			gpio++;
>  			found = true;
>  		}
>  		if (!found)
> -			pr_info(DRVNAME":    (none)\n");
> +			pr_info("(none)\n");
>  	}
>  
>  	if (spi_device && (verbose > 1))
> @@ -1489,7 +1480,7 @@ static int __init fbtft_device_init(void)
>  
>  static void __exit fbtft_device_exit(void)
>  {
> -	pr_debug(DRVNAME" - exit\n");
> +	pr_debug("exit\n");

Delete this as well.

If a driver is working properly, nothing should show up in the kernel
log at all, otherwise it's just noise that everyone ignores.

thanks,

greg k-h

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

* Re: [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-09 18:35   ` Greg Kroah-Hartman
@ 2015-09-09 21:20     ` Noralf Trønnes
  2015-09-10  4:54       ` Sudip Mukherjee
  0 siblings, 1 reply; 8+ messages in thread
From: Noralf Trønnes @ 2015-09-09 21:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sudip Mukherjee; +Cc: Thomas Petazzoni, devel, linux-kernel


Den 09.09.2015 20:35, skrev Greg Kroah-Hartman:
> On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote:
>> Instead of defining DRVNAME and using it in all calls to pr_* family of
>> macros lets start using pr_fmt.
>>
>> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
>> ---
>>   drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
>>   1 file changed, 35 insertions(+), 44 deletions(-)

[...]

> If a driver is working properly, nothing should show up in the kernel
> log at all, otherwise it's just noise that everyone ignores.

This isn't a device driver, it's a module for adding "fbtft" devices
(spi/platform with pdata). When I created fbtft, the Raspberry Pi didn't
have Device Tree support, so I made this module as a way for the end user
to add devices without having to build a kernel.
I haven't seen any module like this in the kernel, so maybe it really 
doesn't
belong here at all?


Noralf.


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

* Re: [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-09 21:20     ` Noralf Trønnes
@ 2015-09-10  4:54       ` Sudip Mukherjee
  2015-09-10 16:45         ` Noralf Trønnes
  0 siblings, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2015-09-10  4:54 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Greg Kroah-Hartman, Thomas Petazzoni, devel, linux-kernel

On Wed, Sep 09, 2015 at 11:20:08PM +0200, Noralf Trønnes wrote:
> 
> Den 09.09.2015 20:35, skrev Greg Kroah-Hartman:
> >On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote:
> >>Instead of defining DRVNAME and using it in all calls to pr_* family of
> >>macros lets start using pr_fmt.
> >>
> >>Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> >>---
> >>  drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
> >>  1 file changed, 35 insertions(+), 44 deletions(-)
> 
> [...]
> 
> >If a driver is working properly, nothing should show up in the kernel
> >log at all, otherwise it's just noise that everyone ignores.
> 
> This isn't a device driver, it's a module for adding "fbtft" devices
> (spi/platform with pdata). When I created fbtft, the Raspberry Pi didn't
> have Device Tree support, so I made this module as a way for the end user
> to add devices without having to build a kernel.
> I haven't seen any module like this in the kernel, so maybe it
> really doesn't
> belong here at all?
Is this driver only for Raspberry Pi?
I have seen someone submitted a drm driver for Raspberry Pi. And I guess
that is already merged.
Tomi (fbdev maintainer) said "Fremebuffer  driver will be obsolete
immediately when there's a DRM driver for that device". And if a drm
driver is already there for Raspberry Pi then ?

regards
sudip

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

* Re: [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-10  4:54       ` Sudip Mukherjee
@ 2015-09-10 16:45         ` Noralf Trønnes
  2015-09-11 10:38           ` Sudip Mukherjee
  0 siblings, 1 reply; 8+ messages in thread
From: Noralf Trønnes @ 2015-09-10 16:45 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Greg Kroah-Hartman, Thomas Petazzoni, devel, linux-kernel


10.09.2015 06:54, skrev Sudip Mukherjee:
> On Wed, Sep 09, 2015 at 11:20:08PM +0200, Noralf Trønnes wrote:
>> Den 09.09.2015 20:35, skrev Greg Kroah-Hartman:
>>> On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote:
>>>> Instead of defining DRVNAME and using it in all calls to pr_* family of
>>>> macros lets start using pr_fmt.
>>>>
>>>> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
>>>> ---
>>>>   drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
>>>>   1 file changed, 35 insertions(+), 44 deletions(-)
>> [...]
>>
>>> If a driver is working properly, nothing should show up in the kernel
>>> log at all, otherwise it's just noise that everyone ignores.
>> This isn't a device driver, it's a module for adding "fbtft" devices
>> (spi/platform with pdata). When I created fbtft, the Raspberry Pi didn't
>> have Device Tree support, so I made this module as a way for the end user
>> to add devices without having to build a kernel.
>> I haven't seen any module like this in the kernel, so maybe it
>> really doesn't
>> belong here at all?
> Is this driver only for Raspberry Pi?
> I have seen someone submitted a drm driver for Raspberry Pi. And I guess
> that is already merged.
> Tomi (fbdev maintainer) said "Fremebuffer  driver will be obsolete
> immediately when there's a DRM driver for that device". And if a drm
> driver is already there for Raspberry Pi then ?

Not sure what you refer to as driver here.

The fbtft module presents a simplistic view of fbdev through
'struct fbtft_par' which the various fbtft drivers use.

fbtft_device is just a kernel module that can add spi and platform
devices to the kernel and it can be used on all platforms. It's not a
driver of any kind. It really does what Device Tree does, it adds devices.

vc4 is an upcoming DRM driver for the BCM2835 display hardware (hdmi).
This has nothing to do with the fbtft drivers which target SPI/parallel
bus connected displays with onboard video memory.


Noralf.


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

* Re: [PATCH 3/3] staging: fbtft: use pr_fmt
  2015-09-10 16:45         ` Noralf Trønnes
@ 2015-09-11 10:38           ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-09-11 10:38 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: Greg Kroah-Hartman, Thomas Petazzoni, devel, linux-kernel

On Thu, Sep 10, 2015 at 06:45:15PM +0200, Noralf Trønnes wrote:
> 
> 10.09.2015 06:54, skrev Sudip Mukherjee:
> >On Wed, Sep 09, 2015 at 11:20:08PM +0200, Noralf Trønnes wrote:
> >>Den 09.09.2015 20:35, skrev Greg Kroah-Hartman:
> >>>On Sat, Sep 05, 2015 at 07:13:45PM +0530, Sudip Mukherjee wrote:
> >>>>Instead of defining DRVNAME and using it in all calls to pr_* family of
> >>>>macros lets start using pr_fmt.
> >>>>
> >>>>Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> >>>>---
> >>>>  drivers/staging/fbtft/fbtft_device.c | 79 ++++++++++++++++--------------------
> >>>>  1 file changed, 35 insertions(+), 44 deletions(-)
> >>[...]
> >>
<snip>
> >Is this driver only for Raspberry Pi?
> >I have seen someone submitted a drm driver for Raspberry Pi. And I guess
> >that is already merged.
> >Tomi (fbdev maintainer) said "Fremebuffer  driver will be obsolete
> >immediately when there's a DRM driver for that device". And if a drm
> >driver is already there for Raspberry Pi then ?
> 
> Not sure what you refer to as driver here.
> 
> The fbtft module presents a simplistic view of fbdev through
> 'struct fbtft_par' which the various fbtft drivers use.
> 
> fbtft_device is just a kernel module that can add spi and platform
> devices to the kernel and it can be used on all platforms. It's not a
> driver of any kind. It really does what Device Tree does, it adds devices.
> 
> vc4 is an upcoming DRM driver for the BCM2835 display hardware (hdmi).
> This has nothing to do with the fbtft drivers which target SPI/parallel
> bus connected displays with onboard video memory.
Ok, Thanks for explaining. Since this is using calls to framebuffer I
thought this to be a framebuffer driver.
Anyways, I will modify the patch as suggested by Greg.

regards
sudip

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

end of thread, other threads:[~2015-09-11 10:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-05 13:43 [PATCH 1/3] staging: fbtft: use strncpy instead of strcpy Sudip Mukherjee
2015-09-05 13:43 ` [PATCH 2/3] staging: fbtft: do not use magic numbers Sudip Mukherjee
2015-09-05 13:43 ` [PATCH 3/3] staging: fbtft: use pr_fmt Sudip Mukherjee
2015-09-09 18:35   ` Greg Kroah-Hartman
2015-09-09 21:20     ` Noralf Trønnes
2015-09-10  4:54       ` Sudip Mukherjee
2015-09-10 16:45         ` Noralf Trønnes
2015-09-11 10:38           ` Sudip Mukherjee

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