lkml.org 
[lkml]   [2010]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/25] drivers/i2c: Use static const char arrays
On Mon, Sep 13, 2010 at 12:47:43PM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/i2c/busses/i2c-stu300.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
> index 495be45..2f7c09c 100644
> --- a/drivers/i2c/busses/i2c-stu300.c
> +++ b/drivers/i2c/busses/i2c-stu300.c
> @@ -871,7 +871,7 @@ stu300_probe(struct platform_device *pdev)
> struct resource *res;
> int bus_nr;
> int ret = 0;
> - char clk_name[] = "I2C0";
> + char clk_name[sizeof("I2Cx")];
>
> dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL);
> if (!dev) {
> @@ -881,7 +881,7 @@ stu300_probe(struct platform_device *pdev)
> }
>
> bus_nr = pdev->id;
> - clk_name[3] += (char)bus_nr;
> + sprintf(clk_name, "I2C%c", '0' + bus_nr);

If people would implement the clk API correctly (matching by struct device
rather than giving every clock a name and trying to use the const char *
as the sole matching token), stuff like this would not be necessary.
The second argument to clk_get() is supposed to be a _consumer_ name
(iow, something to determine which clock for the struct device you want)
rather than a producer name.


\
 
 \ /
  Last update: 2010-09-13 21:59    [W:0.626 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site