Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2232849pxb; Wed, 30 Mar 2022 20:08:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3JqOn8kVK7q43sG1Nw0SKgO8ojUsjLyYsUMwZgkXsMRbmJY/YOVYYhncdhU0jj0fTczl1 X-Received: by 2002:a17:90a:4981:b0:1c6:b6dd:d7a9 with SMTP id d1-20020a17090a498100b001c6b6ddd7a9mr3541325pjh.22.1648696135841; Wed, 30 Mar 2022 20:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648696135; cv=none; d=google.com; s=arc-20160816; b=sWmTI8SI4vDz6C+2D3ciPBkteK2bajiQ6BDIiHpYUkuyoUaoTSCrvpaPmpY/cXOZvV PhQx03R9uBtl0qfIo6nCSrvFG1yu69vKeyMOuWdVzACOfFSLUHO/SsFA+CGY/hDT4RmY kdOoRGy/xJPRyjnjlMkq8TWi8g1F8oCVu1oroP6FwbRWfF5j8PWk2TBXLi2o78cPs41R san4GTOj1ZvATyu2ainu/z2vBXl2GAKr6J8FwkN6bW53V+CqglDd11SGZUMlvqwlCK68 X3Mkpz6vHMN9VgF8ltTd+LLYjzf+INJKxMbC/nfrnsf4gfjrSW5oPvtKtilDE3lYrWw3 jOGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NCSDRJRZlCX3e7uOeDLU6kERCIj4I7Er1tKnwqwYKMA=; b=kWt4AwkqUKs/WUnaNUmTGXJFIqM2Lh41fuztqKEPpHeqULWy8/l4+RHT+OPJo5TIHq g8UfXQlfEazmqPvC1ID4cHPqu2I+PBCwI2ffaJ46cuP45+WmfVRveOw5r0Uc1/xvCM9O F8HhdGk7/qBx7UNNLIIGcr/vas9L663IJCXjlUkBA7JOQTsqexSd4DA5dCF0T8ZzD8Cd wZAAkxGxc1uYIdH1SiSxVqQSKp6neC/ub+HXNTjE09S1mA5z6Y7SNUD1UJaAVRiw7NTW IM6PS3CeWfRtB/CcqtIbEGTHhGMaEx76gzj4Osfoa4+/G2gWo6PURqt8gQFDWj/4UGcd rlpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rmu0hvbO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ng5-20020a17090b1a8500b001bd14e01fb4si2222198pjb.162.2022.03.30.20.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 20:08:55 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rmu0hvbO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 17CE7B18AE; Wed, 30 Mar 2022 19:45:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350596AbiC3TQR (ORCPT + 99 others); Wed, 30 Mar 2022 15:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350699AbiC3TQJ (ORCPT ); Wed, 30 Mar 2022 15:16:09 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65FB73E0C7 for ; Wed, 30 Mar 2022 12:14:20 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id lr4so35043413ejb.11 for ; Wed, 30 Mar 2022 12:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NCSDRJRZlCX3e7uOeDLU6kERCIj4I7Er1tKnwqwYKMA=; b=Rmu0hvbOX8eaSHKORfu191SNwV2QA2hqAtO5gsCaJUm2esBMjCRaCKSAbSwoaF+Hmw dIwzPn0nPjLOzIOUpLTukUBXGqqYHQce7E7kGpF40ySsgsuyyBeZl7YXZSMcV3srcgre DdQS2MWjhoUSVeNVricufO8tcpVtetPppOUWOrFscaDwoIhIwc32kknNESIMVGgTA0zs tlaaulXQIQLV9Zk9pBCafMqtiuWX6tkumTdij8iejOB90Oed+ZefR5UANsJ7gYzEYwDN BVw8Va2tT65rsA9kFZsle+OGfKg2/jbRcBJNatQ5MhNWbiDnH8MktPWpIeU/Fmny39mV 9LAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NCSDRJRZlCX3e7uOeDLU6kERCIj4I7Er1tKnwqwYKMA=; b=VqL0InZU1mehm4H7vQJoYGVrezLVL9dvGDBuuDbG9/rmIGOh8okFsTv2WZ2tYhnKE5 i2XHkn4f2HFYF1q9nZa9I5ojyrSsx313tUC56ms/mCwIn6b/BhcmdQQtTD/9xC6KYcWi JDb1Zo8Kgh7MPmqEhMU9EaDSLBG2G1G7AjQvlfMDwDT1dtHeY2NZ8I88+5s2BdFkg/bU 7CH+VHlv+rs0Eo8ggice7yXU2RRXNd2TD13LFYHUB2EVcoxjrsk5/SUwBr59bZ6zI5QQ 6q27ExSV372gWiDlbyM/458SR3EMczDxzLYjTB6YvG0F/Ctd9RhWAgSjYi6/5zFEVzXx 0EQg== X-Gm-Message-State: AOAM530M5+Ooit482CMTNOHlr5P9CZfR82UdqIifNPppDiOmt3Lb74lN Kd3g/71QgVT51Iiv4d6EWKA= X-Received: by 2002:a17:907:8688:b0:6d2:c19:e1a0 with SMTP id qa8-20020a170907868800b006d20c19e1a0mr1102572ejc.249.1648667658992; Wed, 30 Mar 2022 12:14:18 -0700 (PDT) Received: from localhost.localdomain (host-95-249-145-232.retail.telecomitalia.it. [95.249.145.232]) by smtp.gmail.com with ESMTPSA id eg6-20020a056402288600b0041919c78082sm10257328edb.87.2022.03.30.12.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 12:14:17 -0700 (PDT) From: "Fabio M. De Francesco" To: Nicolas Saenz Julienne , Greg Kroah-Hartman , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, ira.weiny@intel.com, outreachy@lists.linux.dev Cc: "Fabio M. De Francesco" Subject: [PATCH] staging: vc04_services: Convert kmap() to kmap_local_page() Date: Wed, 30 Mar 2022 21:14:14 +0200 Message-Id: <20220330191414.23141-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org The use of kmap() is being deprecated in favor of kmap_local_page() where it is feasible. In file interface/vchiq_arm/vchiq_arm.c, function free_pagelist() calls kmap() / kunmap() from two places. With kmap_local_page(), the mapping is per thread, CPU local and not globally visible. Therefore, free_pagelist() is a function where the use of kmap_local_page() in place of kmap() is correctly suited. Convert to kmap_local_page() but, instead of open coding it, use the memcpy_to_page() helper. Signed-off-by: Fabio M. De Francesco --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index f0bfacfdea80..efb1383b5218 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -431,21 +431,18 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, if (head_bytes > actual) head_bytes = actual; - memcpy((char *)kmap(pages[0]) + + memcpy_to_page(pages[0], pagelist->offset, fragments, head_bytes); - kunmap(pages[0]); } if ((actual >= 0) && (head_bytes < actual) && - (tail_bytes != 0)) { - memcpy((char *)kmap(pages[num_pages - 1]) + - ((pagelist->offset + actual) & - (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), + (tail_bytes != 0)) + memcpy_to_page(pages[num_pages - 1], + (pagelist->offset + actual) & + (PAGE_SIZE - 1) & ~(g_cache_line_size - 1), fragments + g_cache_line_size, tail_bytes); - kunmap(pages[num_pages - 1]); - } down(&g_free_fragments_mutex); *(char **)fragments = g_free_fragments; -- 2.34.1