--- On Wed, 1/6/10, Marek Vasut <marek.vasut@xxxxxxxxx> wrote: > From: Marek Vasut <marek.vasut@xxxxxxxxx> > Subject: Re: Avoiding #ifdefs > To: "CoDeBrEaKeR" <codebreaker28@xxxxxxxxx> > Cc: linux-arm@xxxxxxxxxxxxxxxxxxx > Date: Wednesday, January 6, 2010, 7:02 PM > Dne St 6. ledna 2010 09:38:41 > CoDeBrEaKeR napsal(a): > > --- On Wed, 1/6/10, Marek Vasut <marek.vasut@xxxxxxxxx> > wrote: > > > From: Marek Vasut <marek.vasut@xxxxxxxxx> > > > Subject: Re: Avoiding #ifdefs > > > To: "CoDeBrEaKeR" <codebreaker28@xxxxxxxxx> > > > Cc: linux-arm@xxxxxxxxxxxxxxxxxxx > > > Date: Wednesday, January 6, 2010, 1:32 PM > > > Dne St 6. ledna 2010 07:46:59 > > > > > > CoDeBrEaKeR napsal(a): > > > > Thanks, > > > > > > > > But the stucture am using is pretty > insanely > > > > > > nested. > > > > > > So? Why don't you show us the real code? (please > also stop > > > top-posting). > > > > sorry about top posting. here's the code(directly > pasting it > > from the patch) > > > > +static struct omap_dss_device zoom_tv_device = { > > + .name > = "tv", > > + .driver_name > = "venc", > > + .type > = > OMAP_DISPLAY_TYPE_VENC, > > +#ifdef CONFIG_MACH_OMAP_3630SDP > > + .phy.venc.type > = OMAP_DSS_VENC_TYPE_SVIDEO, > > +#else > > + .phy.venc.type > = OMAP_DSS_VENC_TYPE_COMPOSITE, > > +#endif > > + .platform_enable > = zoom_panel_enable_tv, > > + .platform_disable > = zoom_panel_disable_tv, > > +}; > > + > > +static struct omap_dss_device *zoom_dss_devices[] = > { > > + &zoom_lcd_device, > > + &zoom_tv_device, > > +}; > > + > > +static struct omap_dss_board_info zoom_dss_data = { > > + .num_devices = > ARRAY_SIZE(zoom_dss_devices), > > + .devices = zoom_dss_devices, > > + .default_device = > &zoom_lcd_device, > > +}; > > + > > +static struct platform_device zoom_dss_device = { > > + .name > = "omapdss", > > + .id > = -1, > > + .dev > = { > > + .platform_data > = &zoom_dss_data, > > + }, > > +}; > > > > ifdefs here is what i want to avoid. > > > > +#ifdef CONFIG_MACH_OMAP_3630SDP > > + .phy.venc.type > = OMAP_DSS_VENC_TYPE_SVIDEO, > > +#else > > + .phy.venc.type > = OMAP_DSS_VENC_TYPE_COMPOSITE, > > +#endif > > > > well in the machine init ... > if (machine_is_omap_3630sdp()) the problem is we don't have machine_is_omap_3630sdp(), what's available is something like machine_is_omap_3630(). And there are diff types of boards which is why the #ifdef. > zoom_device.phy.venc.type = OMAP_DSS... > else > DTTO > > what's the problem ? > > > > ~A > > > > > > ~A > > > > > > > > --- On Wed, 1/6/10, Marek Vasut <marek.vasut@xxxxxxxxx> > > > > > > wrote: > > > > > From: Marek Vasut <marek.vasut@xxxxxxxxx> > > > > > Subject: Re: Avoiding #ifdefs > > > > > To: linux-arm@xxxxxxxxxxxxxxxxxxx > > > > > Cc: "CoDeBrEaKeR" <codebreaker28@xxxxxxxxx> > > > > > Date: Wednesday, January 6, 2010, 11:53 > AM > > > > > Dne St 6. ledna 2010 07:04:37 > > > > > > > > > > CoDeBrEaKeR napsal(a): > > > > > > Most of the times its is easy to > start > > > > > > having a lot of > > > > > > > > #ifdef statements in > > > > > > > > > > > your code. Since this is not > a proper > > > > > > thing to > > > > > > > > do, placing the #ifdef in a > > > > > > > > > > > header file would be the > usual > > > > > > suggestion. well, > > > > > > > > i understand this as far > > > > > > > > > > > as #ifdefs in functions are > concerned. > > > > > > How about > > > > > > > > structures? > > > > > > > > > > > for Ex: > > > > > > > > > > > > static struct something = { > > > > > > > .name > > > > > > > > > > > > > > > = > > > > > > "xyz", > > > > > > > > > > .driver_name > > > > > > > > > > > > > > = > "something", > > > > > > > > > > > #ifdef SOME_ARCH_TYPE > > > > > > > .bla > > > > > > > > > > > > > > > > > > > > = DO_THIS, > > > > > > > > > #else > > > > > > > .bla > > > > > > > > > > > > > > > > > > > > = > > > > > > > > DO_SOMETHING_ELSE, > > > > > > > > > > > #endif > > > > > > }; > > > > > > > > > > > > How do i avoid #ifdef here, any > idea?? > > > > > > > > > > If you want to do some run-time > detection, then > > > > > > do so and > > > > > > > > assign 'bla' at > > > > > runtime... > > > > > if (x) > > > > > something.bla = somefn; > > > > > else > > > > > ... > > > > > > > > > > > Thanks. > > > > > > > > > > > > ~A > > > > > > _______________________________________________ > > > > > > > > > linux-arm mailing list > > > > > > linux-arm@xxxxxxxxxxxxxxxxxxx > > > > > > http://lists.infradead.org/mailman/listinfo/linux-arm > > > > > > > > > > > _______________________________________________ > > > > > linux-arm mailing list > > > > > linux-arm@xxxxxxxxxxxxxxxxxxx > > > > > http://lists.infradead.org/mailman/listinfo/linux-arm > > > > _______________________________________________ > linux-arm mailing list > linux-arm@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/linux-arm > _______________________________________________ linux-arm mailing list linux-arm@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/linux-arm
- Follow-Ups:
- Re: Avoiding #ifdefs
- From: Bill Gatliff
- Re: Avoiding #ifdefs
- References:
- Re: Avoiding #ifdefs
- From: Marek Vasut
- Re: Avoiding #ifdefs
- Prev by Date: Re: Avoiding #ifdefs
- Next by Date: Re: Avoiding #ifdefs
- Previous by thread: Re: Avoiding #ifdefs
- Next by thread: Re: Avoiding #ifdefs
- Index(es):