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

Alexey Galakhov agalakhov at gmail.com
Fri May 18 02:49:25 EDT 2012


> 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/***

Regards.
--
Alex



More information about the barebox mailing list