On 13.09.2013 18:08, Ard Biesheuvel wrote: > Move the ablk_helper code out of arch/x86 so it can be reused > by other architectures. The only x86 specific dependency was > a call to irq_fpu_usable(), this has been factored out and moved > to crypto/ablk_helper_x86.c > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> > --- ..snip.. > diff --git a/crypto/ablk_helper_generic.c b/crypto/ablk_helper_generic.c > new file mode 100644 > index 0000000..b63b800 > --- /dev/null > +++ b/crypto/ablk_helper_generic.c > @@ -0,0 +1,155 @@ > +/* > + * Shared async block cipher helpers > + * > + * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@xxxxxxxx> > + * > + * Based on aesni-intel_glue.c by: > + * Copyright (C) 2008, Intel Corp. > + * Author: Huang Ying <ying.huang@xxxxxxxxx> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > + * USA > + * > + */ > + > +#include <linux/kernel.h> > +#include <linux/crypto.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/hardirq.h> > +#include <crypto/algapi.h> > +#include <crypto/cryptd.h> > +#include <crypto/ablk_helper.h> > + > +/* can be overridden by the architecture if desired */ > +bool __weak ablk_can_run_sync(void) > +{ > + return !in_interrupt(); > +} Why not have architecture specific header file that provides this function? With architecture using in_interrupt for this, you would avoid extra function call. -Jussi -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html