From: Andrew Bresticker Subject: Re: [PATCH 1/2] crypto: Add Imagination Technologies hw hash accelerator Date: Mon, 17 Nov 2014 09:11:48 -0800 Message-ID: References: <1415621455-10468-1-git-send-email-james.hartley@imgtec.com> <1415621455-10468-2-git-send-email-james.hartley@imgtec.com> <5467070E.5040104@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: James Hartley , Herbert Xu , davem@davemloft.net, Grant Likely , Rob Herring , "akpm@linux-foundation.org" , Greg Kroah-Hartman , joe@perches.com, mchehab@osg.samsung.com, Antti Palosaari , jg1.han@samsung.com, linux-crypto@vger.kernel.org, "devicetree@vger.kernel.org" , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Ezequiel Garcia To: Corentin LABBE Return-path: Received: from mail-vc0-f171.google.com ([209.85.220.171]:45762 "EHLO mail-vc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbaKQRLt convert rfc822-to-8bit (ORCPT ); Mon, 17 Nov 2014 12:11:49 -0500 Received: by mail-vc0-f171.google.com with SMTP id id10so7338089vcb.16 for ; Mon, 17 Nov 2014 09:11:48 -0800 (PST) In-Reply-To: <5467070E.5040104@gmail.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Fri, Nov 14, 2014 at 11:55 PM, Corentin LABBE wrote: > Le 15/11/2014 00:59, Andrew Bresticker a =C3=A9crit : >> Hi James, >> >>> + >>> +struct img_hash_drv { >>> + struct list_head dev_list; >>> + spinlock_t lock; >>> +}; >>> + >>> +static struct img_hash_drv img_hash =3D { >>> + .dev_list =3D LIST_HEAD_INIT(img_hash.dev_list), >>> + .lock =3D __SPIN_LOCK_UNLOCKED(img_hash.lock), >>> +}; >> >> It looks like the only purpose of this list is to get the >> corresponding struct img_hash_dev in img_hash_init(). If there's >> never going to be multiple instances within an SoC, perhaps you coul= d >> just use a global? Otherwise, you could do something like the >> qualcomm driver, see drivers/crypto/qce/sha.c. It looks like there = is >> some precedent for this device list though... >> > > I don't understand, you propose to use a global, something that lots = of people want to be removed in my driver. > It is not better than this global list. > > I have the fealing that there no good way to get a pointer to a drive= r structure inside the cryptoAPI. > What to you think about adding a void *data in struct crypto_alg > > Before registering an alg you could do: > mv_aes_alg_ecb.data =3D myprivatedriverdata; > ret =3D crypto_register_alg(&mv_aes_alg_ecb); > > and then get it via > struct crypto_priv *cp =3D req->base.tfm->__crt_alg->data; > (a function will be better than that) That sounds good to me.