Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3661548pxb; Tue, 19 Apr 2022 07:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOgC4oGVtZqOEM3WxhaG/xWBDXD/RQpsDawoDiDOdc50u9pZ52CkksIXsvk9DDZ89eGBmW X-Received: by 2002:a17:902:8608:b0:158:c532:d8b2 with SMTP id f8-20020a170902860800b00158c532d8b2mr15831225plo.46.1650378506552; Tue, 19 Apr 2022 07:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650378506; cv=none; d=google.com; s=arc-20160816; b=PTelAngxPwZveSy8jwbEGESZdXrjpLEUyf1DES20V/p2nxP5xPrsG5yGV7EnFWZ9NB xU4c/sT74zoEjqqde+u7Fvs/hnG3pKudWpcAXeLV+0mTJ7WvsnU6fJKTjTLRd+DlGD8+ ch7pKNj+lnPDw8nQ/mL/zzaAOZbUUrAld1wDs4MgOu61OT+Qb6VKss/yEWSoH42+OvnZ jksVb57HALTPluihMLYZScijHOgw5NoKZI0DWPALQSqHJjpZBnTgjDgkw3539eBlPygF t/qTeQXqs+o6Q/qlENwhSnS5DlISHwSEiHal6OQK8EIeySwkEMOwBQAahggl7mBAh+0x xwMw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=98IOdhHNC2mnmVL5iXIWKX612vjuZSVVkSxcC0pWKWk=; b=icXj3YHIqTFN6AK2sKykGREKiYM68s2YFmC1G0XzEiQmuir6pbVDNnG2ZEHCdZB8Qc ZtQWDuTI7UTuqDBtNFCb80nMU6pdMtePy+zXpHBlFaJzk8bMvoVdijkBhMGrc7aneoBV RaQM/HHq3ZG0NqJ9jkD1x7ZMazugLpwRbHjA6w3SbI8Pdbk4d52OiEOeSY84slnJ0UC/ 9tg2Zde33cPbwsX0EtuhI2AHsrDZMCBQao3Zd0T66QSurss0OylIQ3jc/R22AYxKkrvA 5XOyiBV9oXHVRnDTxJMSVvY21ZAg+Lm3NjmEtMc7m3xEjiB6CcczWuZbMZ1yTk7PLT6o d5Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vdwA3fwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a63504d000000b003816043ee3asi11795867pgl.47.2022.04.19.07.28.08; Tue, 19 Apr 2022 07:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=vdwA3fwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239726AbiDRMiD (ORCPT + 99 others); Mon, 18 Apr 2022 08:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239231AbiDRMcl (ORCPT ); Mon, 18 Apr 2022 08:32:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45BAB26104; Mon, 18 Apr 2022 05:24:24 -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 ams.source.kernel.org (Postfix) with ESMTPS id A24BCB80EDA; Mon, 18 Apr 2022 12:24:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBE91C385A8; Mon, 18 Apr 2022 12:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284661; bh=xykrMrmiv5+u/RvlY5+4iaJ7HcGO82DMt1+l6pSg8os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vdwA3fwPMQ9noXcaQca1I1a3nxhol1MGI5dJGS6pPXb4Qpd+APZn2GID0Pyt0fuBg cq8Icl2CbHEYOAAoamiHZ0fnGd5bYTS2NcQuSssvGMtRRlotO+IjebzpPnchOykJVe PlIp4Zh+yIm2RmcW5akN339VBtMJCuWnCZJH8/+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Golaszewski , Andy Shevchenko Subject: [PATCH 5.17 188/219] gpio: sim: fix setting and getting multiple lines Date: Mon, 18 Apr 2022 14:12:37 +0200 Message-Id: <20220418121212.139304618@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Bartosz Golaszewski commit 3836c73e6a2585561af928c6641d74528a8bdfa4 upstream. We need to take mask into account in the set/get_multiple() callbacks. Use bitmap_replace() instead of bitmap_copy(). Fixes: cb8c474e79be ("gpio: sim: new testing module") Cc: stable@vger.kernel.org Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -134,7 +134,7 @@ static int gpio_sim_get_multiple(struct struct gpio_sim_chip *chip = gpiochip_get_data(gc); mutex_lock(&chip->lock); - bitmap_copy(bits, chip->value_map, gc->ngpio); + bitmap_replace(bits, bits, chip->value_map, mask, gc->ngpio); mutex_unlock(&chip->lock); return 0; @@ -146,7 +146,7 @@ static void gpio_sim_set_multiple(struct struct gpio_sim_chip *chip = gpiochip_get_data(gc); mutex_lock(&chip->lock); - bitmap_copy(chip->value_map, bits, gc->ngpio); + bitmap_replace(chip->value_map, chip->value_map, bits, mask, gc->ngpio); mutex_unlock(&chip->lock); }