RE: [PATCHv2 2/3] crypto: inside-secure - add support for PCI based FPGA development board

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, July 31, 2019 1:08 PM
> To: Pascal Van Leeuwen <pvanleeuwen@xxxxxxxxxxxxxx>
> Cc: Antoine Tenart <antoine.tenart@xxxxxxxxxxx>; Pascal van Leeuwen
> <pascalvanl@xxxxxxxxx>; linux-crypto@xxxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx
> Subject: Re: [PATCHv2 2/3] crypto: inside-secure - add support for PCI based FPGA
> development board
> 
> On Wed, Jul 31, 2019 at 10:11:46AM +0000, Pascal Van Leeuwen wrote:
> >
> > > > > +static int __init crypto_is_init(void)
> > > > > +{
> > > > > +	int rc;
> > > > > +
> > > > > +	#if (IS_ENABLED(CONFIG_OF))
> > > > > +		/* Register platform driver */
> > > > > +		platform_driver_register(&crypto_safexcel);
> > > > > +	#endif
> > > >
> > > > When used in the code directly, you should use:
> > > >
> > > >   if (IS_ENABLED(CONFIG_OF))
> > > >
> > > Oops, I missed that one, will fix.
> > >
> > Actually, I tried that first, but it doesn't work in this particular case.
> > The #if is really necessary here to avoid compile errors due to
> > references to datastructures that are within another #if ... (which refer
> > to functions with the #if etc. so it's a whole dependency chain)
> 
> If you're going to use a #if then please don't indent it as that's
> not the kernel coding style.
> 
Ok, I can do that

> I see why you can't use a straight "if" because you've moved
> crypto_safexcel inside a #if, but what if you got rid of that
> #if too?
>
Then it won't compile either because it references stuff outside of the 
module that don't exist. Originally (previous version of the patch) I 
had a different solution removing those function bodies using regular 
if's but for some reason I don't remember anymore that didn't fly and 
I had to change it into this.

> IOW what would it take to make the probe function compile
> with CONFIG_OF off?
> 
That's how I came up with the current code using #if's. If anyone has a 
better solution, I'm happy to hear it. But I don't really want to spend
more time on it doing trial-and-error and not getting anywhere.

> In general we want to maximise compiler coverage under all config
> options so if we can make it compiler without too much effort that
> would be the preferred solution.
>
I understand that, and I tried to do that initially, but that wouldn't
work so I ended up with this as a compromise ...

> Cheers,
> --
> Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux