From patchwork Tue Apr 1 19:23:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 877511 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9404A1E51E7; Tue, 1 Apr 2025 19:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535441; cv=none; b=LWCwf2nmFKekHvxjsuD1cV2CbLgTTlRe0mZUIk40bJ2WGwNIx54QVBlb27NJ6Mb3ioxJRbXhpBNcY7F8asRD7SO+6yO4RFGwCx/knOOz0kzbgMDar9Q/ih1msbxtMFlncOE/4qL4P2QWmSy3MKbxZRzP4ozey6lho8ZbUCOa5Ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535441; c=relaxed/simple; bh=C4U1jwV2UTE3RqFfFsVaxqmVcfNk30K3AoLQSuFxdSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ra3+JFpKlRP/YeIwYGCOwMPekgfjIpqoqiZqCmNgKi4nLca5+Eq6C84gzu/lTXnhGROIoSdY3xiCpxkJ713JGLa6YSXNOQlT8DVJSll2XzYaYqUqxjfYPf9Ffop4otc62LXLG0OSw07bvuzad6QpOLNggRmY2MZxFHjUSPvhGSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Y5Tkqe4L; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y5Tkqe4L" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3914a5def6bso3391734f8f.1; Tue, 01 Apr 2025 12:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535438; x=1744140238; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bH5VLtP+seSAMs8ZXZEEtVjeNgw0O+SRzuS1o+Cett4=; b=Y5Tkqe4LskI2G6HaXGp6C6DSViqitcSv5WTIB9umKTN97oy0qa3RF5P9bwCevC68kB 2ZSDeoaw1NHJ7XcBHrgB/3z7aHbDETmh5rhTgBUgxpMUq8GCpylsXbcQTmxDYGUhSopP JG9Z6+Z7I2sPatYxEOPGDdP6dfCqC1z9foeLmW9S0POYUR7XT951/Qp8e1UuhgF0lI/2 pBkTZdWkdC5sNzcD8/rUO96qkIROFy4ItrtFWfhDZns6gy8LvpNYUCHqgeodD3myACh1 q2UsnTPxfhILrZoC8uVJzanzo6MXkHa3ALx/MKFXrgWyt+JPxchQKwIVKxZxerV3dz48 Vs5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535438; x=1744140238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bH5VLtP+seSAMs8ZXZEEtVjeNgw0O+SRzuS1o+Cett4=; b=mKvb8v+d+mt6oaRF3y7KEEXAoZCjJ5xuiro88vI1VtOX/9b/UN3GIPwfRpLDoS4KV/ JirUoAH7qy3BHPeFCknp998+PnC1fc6qJaumngWNDDjj2vO92q9t7rKYXw8+9UEa+7AS 6ky11dFqU1BVOEB0mpxzbpvzuqC7pqjMyt/xSaB+F6LtkTYvE+VH6m2TcrI6IvyrYIUj rtz6wYKWYwig0aOhdxJxiNUz2Bl54L00pXszSaGHZ2hENVNUZyzoC83sTY+HjUvtRsRH on6B4cK2aZGajgPcoSPZ6NWKXjiwvOf0UYsL6WBwWCDcPFqpe4w5LByxENFhGQGvP56z JmTw== X-Forwarded-Encrypted: i=1; AJvYcCUlxTAXiDzzb6cXk8lebTpbOePW619RRKK5SaxYB3KvpXusNJOGQC+z+yWdw2+RJDMJtV5wjZw1MyavXsKr@vger.kernel.org, AJvYcCX0SEhyFsrkMo2wEiS5rFR5itEbyPxPNh57mtMxXyZOaXMsm0DDv+nvE1Szr+4ebO/g2R8ikbrUYBAkqhM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1NtydY5+4ZnNjGwfPfUHcOqEBn3QPCyOdppsj+d+EAr9RFvWH PGfy/vEWvbBD4cDxuVgmPmDmZxrcgDI8eOho+DP3USMePIW3PWTe X-Gm-Gg: ASbGncviEgzAMC8Ru3zP6ULWl6tz4K/Fo5jziuei/9+IjqTX6eF4Ztc/RItD4weeMTi 9asYnCwJAhZdjJJVC8vkIJ9wqAgmRUY7nbrW3YhS4SfIr728dxRAZcovt66DPhSJ9g+0aWtknWo NudvhfbuRgMZpZN2gr6yp6ntKacXhC1u3Ik5yWH9/6qVQwrA+1jkJsrqOpRSLSpHPCvRk4SvO2R PJxzDayvcG23t7Vtoqtt5+EsfMJ8PJ9A6wq+9pal8OlIBV4/OEVO2dAChnqX/rR1ROhCrSVnwqQ ke1ieycjGv3q3ey2Nyg2a1565BmKIP6C5URQZnuYBIkmhApau/A9UZ9GcwzA20+mbbMA5nB1FsR JYzfPHe8= X-Google-Smtp-Source: AGHT+IEeNatuio+GXvnz6jtis2Ifu8CXZWb0U2xpbF/9zUj/YkR/FHukm5fxlTJZb1XZQEdPrISlBQ== X-Received: by 2002:a05:6000:40cf:b0:391:2e6a:30fe with SMTP id ffacd0b85a97d-39c121188b9mr9767506f8f.39.1743535437739; Tue, 01 Apr 2025 12:23:57 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:57 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 2/6] crypto: sun8i-ce-hash - remove duplicated fallback checks Date: Tue, 1 Apr 2025 22:23:17 +0300 Message-ID: <20250401192321.3370188-2-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove duplicated fallback checks in sun8i_ce_hash_digest(). The same checks are already done previously in sun8i_ce_hash_need_fallback(). Signed-off-by: Ovidiu Panait --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index 3f9d79ea01aa..2c2d285de154 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -244,21 +244,11 @@ int sun8i_ce_hash_digest(struct ahash_request *areq) struct sun8i_ce_alg_template *algt; struct sun8i_ce_dev *ce; struct crypto_engine *engine; - struct scatterlist *sg; - int nr_sgs, e, i; + int e; if (sun8i_ce_hash_need_fallback(areq)) return sun8i_ce_hash_digest_fb(areq); - nr_sgs = sg_nents_for_len(areq->src, areq->nbytes); - if (nr_sgs > MAX_SG - 1) - return sun8i_ce_hash_digest_fb(areq); - - for_each_sg(areq->src, sg, nr_sgs, i) { - if (sg->length % 4 || !IS_ALIGNED(sg->offset, sizeof(u32))) - return sun8i_ce_hash_digest_fb(areq); - } - algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base); ce = algt->ce; From patchwork Tue Apr 1 19:23:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 877510 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5F3B20E711; Tue, 1 Apr 2025 19:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535443; cv=none; b=UWqJu+BVx7XRHmw3pMpXlxNSopt8nmY8qAgWNZu5+ikUy84c3CfiAQ30Y5PGAZqYbbcUaX3TN8RY1IffBl6VBi7nScOegmfsiAke0MUzUYh2PNHP0vuVCrZmmn+ngEjkUpnlIWMevQSPMr2FJ0J6rUPsEjy1/cz+FANBvPSRyyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535443; c=relaxed/simple; bh=ujIPapzlL7mjHgW3aviWBgtecWjNM0nt1PjVn8npb/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ua7pw6aqAw10CdmKPtRfDDA+3xHJTC7POc5NqKZ0IXgwHw5ikxx5jnRoCGRzVk99/DWxUyQZu7tKg/aus1qJRAeMCxCDaWLpWFmqAInkyLCHbPbEt4tw+kAV3uQZaMOrMxqzUzK4WyiQgZ75HvIno6eGsh1wwNnCNzrLGTHBBD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QoJa2WbX; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QoJa2WbX" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-39141ffa9fcso5689341f8f.0; Tue, 01 Apr 2025 12:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535440; x=1744140240; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I/+iZ7oXBPhE3cNOeJn0BX2fJsfTTe1JAGSbvb0XfLY=; b=QoJa2WbXDqIAoHWrux+LY1Tl1WDbLQKigpeYP5fqAwR4rU8D4HgZQInkHiOLWIMLh5 moAd31EO/a+Ixx01EsJBfbRfyjkgIimR6nVzuxaDGe+uti8vfzr7yEG6Oz36JcZGYhgR GcVYzHnVlzLoszC4KKawPVPhWocItuxXotUM0WuiIYBEg+jrVOBov2mNh2nZLwnPMdFD lZzv/Eo1E6GIdcjb38TN3VGMVtWLhSddIn5wA0pmnSvcDIcBWzICZItM81xSgaSqMgHd IUV0DzmVs89bRWSKHcLsK8DtbcDYNrPhivlO8/qS6A7KUAaPp+j2jKt0D6bCHDNpQ9F5 UM0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535440; x=1744140240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I/+iZ7oXBPhE3cNOeJn0BX2fJsfTTe1JAGSbvb0XfLY=; b=NnPF9XtdtSdgJYHUdvD+VdTskUVfvCEz/2vdYyieMpOOYndh3dZsFIuqhV+FCYjo25 psMhc/aZgCqDP8JjJS547U0IRgiowF0RHOp5ybrbKjFby/0M3CESOcyi90JdqbHgEF0p NupSS4EypDOOupK53x282P8jbje7W8B3RsQV5NkutNo5b9tYBrT4wlebDMU+vVvSz//Y qsHyMcDmUVIOgiEPz+jxIN+ehh1Oz/DF6/5JafOGBf3J+S5u4weYLQ4UoRIAqfH9E3ok 1xXP9WFpZ+ISwGs7oE0pxBqibvSOO9/RkZg1WlCgGM6Yz1wpF93dRKNskjWY0S9HI0r1 RSnQ== X-Forwarded-Encrypted: i=1; AJvYcCUkb8YkIzhC9bikM6S7mXHnVsa+EMvx62+hD2wlO+i9+j5ylmTK5aRFZ5etQIRCec/nOnnrxHdxVQinJCeM@vger.kernel.org, AJvYcCVD9RA25rH/EVnNWBbUCsN2nfVBspM8wPMTrdV/ntzsxG1hO8BEj5A9xzBq5DVXmnyUAOqLXwiGAOehCvY=@vger.kernel.org X-Gm-Message-State: AOJu0YxtMtU3PtqwV8gKnG39UqDXlcCCJKtYcAU6VR+oj4gne6KL0GEs TjLw3iJzLi33MbuSpT9tGW8HPCyxF9J3y1ZPohJtQjRvlettPek2 X-Gm-Gg: ASbGncutRJJLRzQCF+myWwOnMWpM25fYRHKr7fCUVaw0cTs8/Qqbj3UTa2I/UFm/o5K CCL27v2EKtlmzkOd3DVoEn3OPIgtgXI/R+m5MlBQEKeJ5nWLYi3xY6GYh3/MiGZmjPYfeLfPSTX /aNqQDNjrz0Ali4ylkKlJxfRKc/0Go7fxjtub1Ni7FyDT61VZM7cpC6LjCv/fKYryGey2SIp7k8 bktFmMHeimZ3AMecdErXKyTpPNAG7f2jF2Op2HlOxFQ+Gl1jIv0C+u8dqDji9fo7XEkzRPoiyHm Ngi5fzvbIul13bNX9Fsm3c0Z/+eThrj9+AxDXZ4y/JgMjoXLHjoO11p8shMtLzsiRn5JGI1V X-Google-Smtp-Source: AGHT+IEroLhlH55Nn0a2Cu0BMYw27BSdC4OLp0dlkWXs82H+dhWwczs/WCChC+qm41GDorZgNFvJwA== X-Received: by 2002:a05:6000:40ce:b0:399:6ad6:34 with SMTP id ffacd0b85a97d-39c12118e33mr11160301f8f.35.1743535440077; Tue, 01 Apr 2025 12:24:00 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:23:59 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 4/6] crypto: sun8i-ce-hash - drop CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG ifdefs Date: Tue, 1 Apr 2025 22:23:19 +0300 Message-ID: <20250401192321.3370188-4-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 'struct sun8i_ce_alg_template' is always defined, even with CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG disabled, so the ifdef guards are not needed. Make sure the statistics have IS_ENABLED() checks instead. Signed-off-by: Ovidiu Panait --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index b0959d8218cb..530c5181d73c 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -31,9 +31,7 @@ static void sun8i_ce_hash_stat_fb_inc(struct crypto_ahash *tfm) algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash.base); -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG algt->stat_fb++; -#endif } } @@ -354,9 +352,9 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) flow = rctx->flow; chan = &ce->chanlist[flow]; -#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG - algt->stat_req++; -#endif + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) + algt->stat_req++; + dev_dbg(ce->dev, "%s %s len=%d\n", __func__, crypto_tfm_alg_name(areq->base.tfm), areq->nbytes); cet = chan->tl; From patchwork Tue Apr 1 19:23:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ovidiu Panait X-Patchwork-Id: 877509 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 870F5215160; Tue, 1 Apr 2025 19:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535446; cv=none; b=IYT9A06X0vqJ0YSs1PpX8Q+lswsN6mjRCUQSoLn6DTykVeyPzCD4dABP2t8/Utz+u+dX3FIGN+YApxOjkI+CeTLoNg0WicMNYdNFxo6d7+zRdXmMzu2iOAbFsThhWZd7pPkYSq+1fH/cG1m03atrdV4FFBa3g51oSc+8P97iptQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743535446; c=relaxed/simple; bh=NRVhERk2BAR2xqBjMJivMm5iv64usDIZsZsw3SPAVmI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rjNtLJG9VGukvgCKa0oupprkMzxNpjyUsPJMFr4k42Ea38GXTwCf91urzaMv4BZ79NA24gTrgu0VhsnDJN9eIl4KkBm8tb0bb2HTYBvySEx8IyT71UmNQ9S5ll9+58eqpVXbWPDb0xIutgB41zq/JEPeNS2oKEr0fYn/5U4Yw7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XY9ElwBh; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XY9ElwBh" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-399749152b4so2722923f8f.3; Tue, 01 Apr 2025 12:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743535443; x=1744140243; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FPD+7okMltc/dAuqJI3eHLzfTcaBka9M3a4LKpm2uhg=; b=XY9ElwBhlffVSXsL5phzHmRrZfJt0aNCilJpmYPRsq0x52cnBo10nbFZMoiH2Mr9zD pxMORSxv8h9NEqbfFlSiOdN2hcRM9C7VW1RF/tEdQwqT1pQYSytQBI//LQHNJMFsZSbs WPwHIE+rEyUypbdDku+DppDeiPpsWM21i9Bp1mwGsF7ZTvetLoD/VEiTuh/Aiq+AZwUT VDE7jafLiQwkyCDd652vEFSdjm3TqB2VPB/CnwDKEm/BSrU1lm8b8W9KS3j2uQEYGJV/ iDDubM9w49kw41Rj+Mf9Q7yhyJSRRfw9/NoeC37kPXJmM62amcX0jsouEv4Hxm2h49gy 5Sgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743535443; x=1744140243; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FPD+7okMltc/dAuqJI3eHLzfTcaBka9M3a4LKpm2uhg=; b=fcQk9My1ZOaIunKzjAQqdviNVjZiqV9Chva6hkSG+rLHL4bNJ9a4VDmVJRujM8BO4q elaxloO1jwxirTVetdifyJjbiq77cZCMheX0TYXgBLJyIwWEnYTeB1qoJuc6qo7Aqvha qytyov6tPOTxj96dpVpwQ6yJ8vayXVUlHKFy9/ROA8J+CWeJ7Far5RvfzmxBroy9B3yc Gmlp+U486UKuLRF0SF83t5gaabFTLJQ0JGZWGjDkectCqK0z3VEaQ53yKyn0JYVXBvKK IJrGImjWlH0Hon7IHYOni0HY1heqRdKusxcgmfR1xwqfXYY1MybCpcNvzRRVP8ySjkJI 5+Xw== X-Forwarded-Encrypted: i=1; AJvYcCW9FxNLFS8nxbVuC1YTRCgT3Hgpy1Cn8fATVQZhzI9vxoW0YZZOUqsPkYVXzejvJcKpj+VpUjqHATPFP6k=@vger.kernel.org, AJvYcCXYVRTYPmy9WTqLo/HSn14tH6JZCB8ab+5yvdt8n2O43l2nG9T4lqknnb09G2v9xjD5svfMqBLUWOVbzqHx@vger.kernel.org X-Gm-Message-State: AOJu0Yzz31vl8RAyX1AIBqATzYMHRpoPtzzVVgdkkgltvsqlX/jW+S0+ DCETGyDcXh/QKCH1gMnfTUWMhlcfoYb84e4upPn72U6BiYuqvrOf X-Gm-Gg: ASbGncthuP/6xJuCawF+GmOjd3SeyR5cusiuYSmZqzPJ78YHqBLOEhJYGPpqHPMZUsh z0fDmMXLR4L1sNyejgQ2S+fWZP1LZQzDUDYEopUp5bd6oLpToy/huPC1zzGudgZA7FVCbLJg/l2 B7LsLhq57xJJjpPlJOOPVho3UQ0ODX7rZTJOGSNU1GPC/mt+kFm4slKBeTxQzesRWF12K/8jwAL RAu/KoF68euCPjnYomkSP5eX6ekT0w1vSwCtyHBLCX6aUqZMsiAP9bqL7NyMHDILH/xTpjCzviO xzyucW41Nlf7fiqFQwfmFngSaRbrBdOTZBZpjXPj1UlFgywdPzTOk0WwOEKF+1atotou1EoB X-Google-Smtp-Source: AGHT+IEaiKwLn7JsnD/3lJiU7PGrasf+3+s7Prm3UNAJkOHPWOkOwYJ5/33v9GOGEA2VI8+dpTqX0g== X-Received: by 2002:a05:6000:1a8b:b0:39a:c9c1:5453 with SMTP id ffacd0b85a97d-39c2367439dmr3498181f8f.49.1743535442768; Tue, 01 Apr 2025 12:24:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:c50a:8800:cf9e:ee0b:4a01:37f6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66aa32sm15353438f8f.50.2025.04.01.12.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 12:24:02 -0700 (PDT) From: Ovidiu Panait To: clabbe.montjoie@gmail.com, herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org Cc: wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Ovidiu Panait Subject: [PATCH 6/6] crypto: sun8i-ce-hash - use API helpers to setup fallback request Date: Tue, 1 Apr 2025 22:23:21 +0300 Message-ID: <20250401192321.3370188-6-ovidiu.panait.oss@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> References: <20250401192321.3370188-1-ovidiu.panait.oss@gmail.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than setting up the fallback request by hand, use ahash_request_set_callback() and ahash_request_set_crypt() API helpers to properly setup the new request. Signed-off-by: Ovidiu Panait --- .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c index f2481e1585ba..ba13fb75c05d 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c @@ -92,7 +92,9 @@ int sun8i_ce_hash_init(struct ahash_request *areq) memset(rctx, 0, sizeof(struct sun8i_ce_hash_reqctx)); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_init(&rctx->fallback_req); } @@ -104,7 +106,9 @@ int sun8i_ce_hash_export(struct ahash_request *areq, void *out) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_export(&rctx->fallback_req, out); } @@ -116,7 +120,9 @@ int sun8i_ce_hash_import(struct ahash_request *areq, const void *in) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); return crypto_ahash_import(&rctx->fallback_req, in); } @@ -130,9 +136,10 @@ int sun8i_ce_hash_final(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, NULL, areq->result, 0); return crypto_ahash_final(&rctx->fallback_req); } @@ -144,10 +151,10 @@ int sun8i_ce_hash_update(struct ahash_request *areq) struct sun8i_ce_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, NULL, areq->nbytes); return crypto_ahash_update(&rctx->fallback_req); } @@ -161,12 +168,11 @@ int sun8i_ce_hash_finup(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, areq->result, + areq->nbytes); return crypto_ahash_finup(&rctx->fallback_req); } @@ -180,12 +186,11 @@ static int sun8i_ce_hash_digest_fb(struct ahash_request *areq) sun8i_ce_hash_stat_fb_inc(tfm); ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); - rctx->fallback_req.base.flags = areq->base.flags & - CRYPTO_TFM_REQ_MAY_SLEEP; - - rctx->fallback_req.nbytes = areq->nbytes; - rctx->fallback_req.src = areq->src; - rctx->fallback_req.result = areq->result; + ahash_request_set_callback(&rctx->fallback_req, + areq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP, + areq->base.complete, areq->base.data); + ahash_request_set_crypt(&rctx->fallback_req, areq->src, areq->result, + areq->nbytes); return crypto_ahash_digest(&rctx->fallback_req); }