[PATCH 2/7] Split S3C generic and S3C24xx specific code

Sascha Hauer s.hauer at pengutronix.de
Fri May 18 04:38:35 EDT 2012


On Fri, May 18, 2012 at 12:49:25PM +0600, Alexey Galakhov wrote:
> > Mostly a matter of taste. But sometimes these functions should use a common
> > name: when they are used by a shared driver.
> > If you call a S3C2440 related function by a S3C2440 related driver or board
> > file, we should use a SoC specific name. When we call a function from a
> > driver used for S3C2440 *and* S3C6410 it should use a non SoC specific name.
> > This is a "should" and I fear my S3C24xx code is not perfect in this way.
> 
> What if...
> 
> int s3c24xx_get_pclk(void);
> int s3c64xx_get_pclk_msys(void);
> int s3c64xx_get_pclk_psys(void);
> 
> And in some driver:
> 
> #ifdef ...
>     x = s3c24xx_get_pclk();
> #else
>     x = s3c64xx_get_pclk_msys();
> #endif
> 
> In some other driver:
> 
> #ifdef ...
>     x = s3c24xx_get_pclk();
> #else
>     x = s3c64xx_get_pclk_psys();
> #endif
> 
> Ho to do that correctly? Right now I prefer that way:
> 
> int s3c_get_some_driver_clk(void);
> defined somewhere in arch/***

Me too. As said, ideally we would have a clk_get(dev, id), but we don't
have this atm. (We have it on Atmel, you could do the same, but I don't
ask you to do this if you don't want to)

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 |



More information about the barebox mailing list