* Tony Lindgren <[email protected]> [091208 08:39]:
> > @@ -391,6 +405,31 @@ int omap_mcbsp_request(unsigned int id)
> >     }
> >     mcbsp = id_to_mcbsp_ptr(id);
> >  
> > +   if (cpu_is_omap7xx()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u16) *
> > +                           OMAP7XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap15xx()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u16) *
> > +                           OMAP15XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap16xx()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u16) *
> > +                           OMAP16XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap2420()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u16) *
> > +                           OMAP24XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap2430()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u32) *
> > +                           OMAP24XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap34xx()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u32) *
> > +                           OMAP34XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   } else if (cpu_is_omap44xx()) {
> > +           mcbsp->reg_cache = kzalloc(sizeof(u32) *
> > +                           OMAP44XX_MCBSP_REG_NUM, GFP_KERNEL);
> > +   }
> 
> How about just set the cache size above based on the processor,
> then do kzalloc here:
> 
> mcbsp->reg_cache = kzalloc(size, GFP_KERNEL);
> > +   if (!mcbsp->reg_cache)
> > +           return -ENOMEM;
> > +
> 
> That way the kzalloc and error checking are in the same place.

Actually since we already have mach-omap1/mcbsp.c and mach-omap2/mcbsp.c,
it would be best to pass the cache size from omap1_mcbsp_init and
omap2_mcbsp_init. That leaves some of the if cpu_is_omapxxxx() else
stuff.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to