Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp660395rwb; Fri, 23 Sep 2022 02:18:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66o4Afs2HqjvQax7cVXdKqMDLphakBwHaZV68/MXLle55Vgabu7ivF3obzh/eMv+8CuQFF X-Received: by 2002:a17:902:ea0b:b0:178:336f:eaec with SMTP id s11-20020a170902ea0b00b00178336feaecmr7789516plg.53.1663924725480; Fri, 23 Sep 2022 02:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663924725; cv=none; d=google.com; s=arc-20160816; b=x9tAl/ShRXTdXGpzgZYNgZMYDJPMf0/nDXF0ciqV89E+2KmQ3pAJEZA1Mh5x3VJGt0 Y5E9Psab00CCymUHSKXhw82v7a6rUU70m4HYn+LWcV9kdph8NAS1MkQCyAu4VRdn2hC6 p3GScof9dkrRj5IUdBhfj0MlkaTcoYrbOSKTOQj124eXDXJaq4MbLr5gaHyyIXBcf+n5 AGRJ2Xw52JOy+q3vDb37gZc4NfkgcknJ0NvztwTkw40Pe0nm6KJ5WFNJVuaHoofb2PFN He5pMSP8MzET0kN2h68VBWJ1eZs7jLWH5TSvrILbIydCDOyg9cguSZb5MnUaxcy/nUhM DvMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:subject:to:from:cc:references :in-reply-to:content-transfer-encoding:mime-version:dkim-signature; bh=TWVccXdc7Aro01vqWjwwXCx26VkNIA3OpwAbOiJw1Mg=; b=w3d9/m5uEsv50oKX4QW52JzXmAGVsN9V7Ps5hAdyeLy3wuK7x6UBwxfXO7vk4FBJhn Rs4FJm4aGqJ1kaLtG+sNSUM/cLdluPUxR3NBy5BLqHQX2YuYsc3ib+/blUfmmavbqkBf 52xqcnjWUjtcTlIDxOOg0zyQyVXSepuIr3X3mBRqpuZNv51WnFVAQFij2gRmuTKoz/a/ sV63zrK/RvLs7kDCBGRUUVWg7jocRjXBOhor+7zAXdRdQ/Z+eXrfuzTm4lPekyU2BctQ 78HlUzpESnf71ElWMsJj9XyYG91+GW8iOCPSNKLhL2kcTXwHtq6zzP4/ETiJTILfAfww 3ruA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mrE38i+k; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a170902d89200b00176d22a068csi2112245plz.515.2022.09.23.02.18.22; Fri, 23 Sep 2022 02:18:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mrE38i+k; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbiIWJJK (ORCPT + 99 others); Fri, 23 Sep 2022 05:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbiIWJJG (ORCPT ); Fri, 23 Sep 2022 05:09:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBF0212DEA6 for ; Fri, 23 Sep 2022 02:09:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EC1861E00 for ; Fri, 23 Sep 2022 09:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6477FC433D6; Fri, 23 Sep 2022 09:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663924144; bh=5t7i2UtqHk/DuyQu0Msr77BoDZnE+bGRPNlsDkeFoyo=; h=In-Reply-To:References:Cc:From:To:Subject:Date:From; b=mrE38i+kGZsOIm08KEgSL/lwG4poA1Sh3OMRL6o9Ug9y2u2UfIT72BBL5qh/5bEGo a2G9VA8FxitoEdSoIX2WHtOgfaV8LzfV9Y+swFdnE0sqANCNy3lNM97ET8evmtH/zX +KkeqPKRndaRP8d+HrnXcbLLQrZSNBZ4kuAHUqx8PQODFYdrsx52fdmXzJ2w0VVoJH ociMDVbjMfc1B6th6wtssZovZjia2sp9gCEIV4mrdWBay9PVJW4pcj7jv1W61nxD9J krO8ZDTMHWTdfIgmuEAz3Kq0asiBrvgWk03Dkhf6Hb1LMxmP93SpskwLt4hr8r2yLZ ZZFeVKQjSYWkQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <131f0d802d4e251dd8f98672260a04c2f649440c.1663660578.git.pliem@maxlinear.com> References: <131f0d802d4e251dd8f98672260a04c2f649440c.1663660578.git.pliem@maxlinear.com> Cc: linux-crypto@vger.kernel.org, linux-lgm-soc@maxlinear.com, Peter Harliman Liem From: Antoine Tenart To: Peter Harliman Liem , herbert@gondor.apana.org.au Subject: Re: [PATCH 1/3] crypto: inside-secure - Expand soc data structure Message-ID: <166392414185.3511.12102278740497366855@kwain> Date: Fri, 23 Sep 2022 11:09:01 +0200 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Quoting Peter Harliman Liem (2022-09-20 10:01:37) > @@ -410,20 +410,25 @@ static int eip197_load_firmwares(struct safexcel_cr= ypto_priv *priv) > int i, j, ret =3D 0, pe; > int ipuesz, ifppsz, minifw =3D 0; > =20 > - if (priv->version =3D=3D EIP197D_MRVL) > - dir =3D "eip197d"; > - else if (priv->version =3D=3D EIP197B_MRVL || > - priv->version =3D=3D EIP197_DEVBRD) > + switch (priv->data->version) { > + case EIP197_DEVBRD: > + case EIP197B_MRVL: > dir =3D "eip197b"; > - else > - return -ENODEV; > + break; > + case EIP197D_MRVL: > + dir =3D "eip197d"; > + break; > + default: > + /* generic case */ > + dir =3D ""; > + } Why "generic case"? We shouldn't end up in this case and the logic changed after this patch: an error was returned before. The if vs switch is mostly a question of taste here, I don't have anything against it but it's also not necessary as we're not supporting lots of versions. So you could keep it as-is and keep the patch restricted to its topic. > +static const struct safexcel_of_data eip97ies_mrvl_data =3D { > + .version =3D EIP97IES_MRVL, > +}; > + > +static const struct safexcel_of_data eip197b_mrvl_data =3D { > + .version =3D EIP197B_MRVL, > +}; > + > +static const struct safexcel_of_data eip197d_mrvl_data =3D { > + .version =3D EIP197D_MRVL, > +}; > + > static const struct of_device_id safexcel_of_match_table[] =3D { > { > .compatible =3D "inside-secure,safexcel-eip97ies", > - .data =3D (void *)EIP97IES_MRVL, > + .data =3D &eip97ies_mrvl_data, > }, > { > .compatible =3D "inside-secure,safexcel-eip197b", > - .data =3D (void *)EIP197B_MRVL, > + .data =3D &eip197b_mrvl_data, > }, > { > .compatible =3D "inside-secure,safexcel-eip197d", > - .data =3D (void *)EIP197D_MRVL, > + .data =3D &eip197d_mrvl_data, > }, > /* For backward compatibility and intended for generic use */ > { > .compatible =3D "inside-secure,safexcel-eip97", > - .data =3D (void *)EIP97IES_MRVL, > + .data =3D &eip97ies_mrvl_data, > }, > { > .compatible =3D "inside-secure,safexcel-eip197", > - .data =3D (void *)EIP197B_MRVL, > + .data =3D &eip197b_mrvl_data, > }, > {}, > }; The pci_device_id counterpart update is missing. > +++ b/drivers/crypto/inside-secure/safexcel.h > @@ -733,6 +733,10 @@ enum safexcel_eip_version { > EIP197_DEVBRD > }; > =20 > +struct safexcel_of_data { > + enum safexcel_eip_version version; > +}; The driver supports both of and PCI ids, you can rename this to safexcel_priv_data. Thanks! Antoine