Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2518430rwb; Wed, 30 Nov 2022 07:34:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf4J1w/dis9j8Bgqtig4brNRwg8jDpMb4YtziSS89GHTXNyswGWi1GpbQXJWcn+7A+iEthle X-Received: by 2002:a17:907:6d12:b0:7b2:bb8c:5398 with SMTP id sa18-20020a1709076d1200b007b2bb8c5398mr40691794ejc.573.1669822486859; Wed, 30 Nov 2022 07:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669822486; cv=none; d=google.com; s=arc-20160816; b=MMUxD+vgtHxQpY9I3TS8L+ZDWNYwlPbkOBTX2I3CM6eAPxr5gPxvBY9iP+dj2vlytM 9RTLCl2lX5H508Zh+CpmGvdpFkU8h+2zxIgI1+0fnNrHxIXXyHnRGrtiddqAQaTvP1Uj +7m4rQsQhwuu2Gpzvs7bXtM1ySY/QYF1kE0Fo21mYZrd6LloGLzIlpBlXgka3+GY77/P z5TvsJG73hZBvrHh8iIyuLXRTBsPP+NOxLC20XEfsAu2vkLfTgpc39UxNOkYqbNh9lDo BUTr1nF8ttpsAP8pXMmEWp6v/VnaIfjDkMcXyk+XHf1Q3i5ZiZBnayypGGHtKvWfmz9b 4wlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=V9MB2tN+Gn8qbfBlsHKNl3sS97rAbcF+9IUKvF5qTZs=; b=dLFx5siPF6ttWnby/7my8tlvREou3PLwaxT5TGAzCt60GpPeBLsRkhZAL+KWzWLZew rXtEEWdehLbHulxOlWj4UjikR7Qm46KhxmK7hnwzfxleVUmCsHQPOaL08ZJrIkXz+jSP /U0kSBBzhdaU/1C9/jvOgusm/DmKsc3UdQfEvMOwDTihqucb1Rx2ytpKTJckh1OYwZfF qYXWaInF5AWhJZIBHHecfRJ2+Dw29vWy98UsLH9qbggm8SOTCh1GJMFNDdUz06amN8vG CtqbdwNpmu5uq2Qp7V8hlsvTVmIlBwyuQGQbf6pp433hdScHrq0/t7F9k3cbPW7LhZEn 8zsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CAcY2kH/"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a170906370200b007ae4c686a4dsi1227229ejc.649.2022.11.30.07.34.24; Wed, 30 Nov 2022 07:34:46 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="CAcY2kH/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiK3O6M (ORCPT + 83 others); Wed, 30 Nov 2022 09:58:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiK3O6J (ORCPT ); Wed, 30 Nov 2022 09:58:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D514303F7; Wed, 30 Nov 2022 06:58:07 -0800 (PST) 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 A6AB561C32; Wed, 30 Nov 2022 14:58:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2419C433C1; Wed, 30 Nov 2022 14:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669820284; bh=8qCtikAAK5ewVDLbkyFaVd5mw/YPRA/xoHRbnUNco6E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CAcY2kH/2zAdyjKKueldIyXfICaXuvzKuZRPy8r/7GZORaNctWvPrXkMgUd6A4mnS BGSgQzoPAEGQ2oCF+2hfDMoTdt8qzacuM2hbyIpTMMtyT5KwuS2w0980IDO623J1Sk 49NslQa6HisN1wtnMZTUCjgCxf0FWj8IbcjyPwn3ZryNvdRSq2Odt4HKwMHUsgJz4L TIVlw/gGceQjkGI5UOrCfIA/bFYeU0fusdJwhY8Ll9YShXiWs6T53wv9jnAVfbwm6L MECg8lqtDQMpFdP2I97DWGusxQguZAMa1RAuqhZdAX/Y0vFu4jVqD7q1cjjLQs2Xd6 uq7MugyilxkkA== Date: Wed, 30 Nov 2022 14:57:59 +0000 From: Mark Brown To: "A. Sverdlin" Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij , Lukas Wunner Subject: Re: [PATCH] spi: spidev: mask SPI_CS_HIGH in SPI_IOC_RD_MODE Message-ID: References: <20221130143948.426640-1-alexander.sverdlin@siemens.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dzZ2XdGmVBkCOrh6" Content-Disposition: inline In-Reply-To: <20221130143948.426640-1-alexander.sverdlin@siemens.com> X-Cookie: Jesus is my POSTMASTER GENERAL ... 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-kernel@vger.kernel.org --dzZ2XdGmVBkCOrh6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 30, 2022 at 03:39:48PM +0100, A. Sverdlin wrote: > /* read requests */ > case SPI_IOC_RD_MODE: > - retval = put_user(spi->mode & SPI_MODE_MASK, > - (__u8 __user *)arg); > + tmp = spi->mode; > + > + { > + struct spi_controller *ctlr = spi->controller; > + > + if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods && > + ctlr->cs_gpiods[spi->chip_select]) > + tmp &= ~SPI_CS_HIGH; > + } > + > + retval = put_user(tmp & SPI_MODE_MASK, (__u8 __user *)arg); > break; > case SPI_IOC_RD_MODE32: > retval = put_user(spi->mode & SPI_MODE_MASK, What about SPI_IOC_RD_MODE_32? On the write path the code is shared... --dzZ2XdGmVBkCOrh6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmOHb3YACgkQJNaLcl1U h9CQJgf/daoxEQABFU5PoGFf/jNfQvZzeIJqAAztUAaw61V0mVzndC36v23iuL3V Fj1dBlPh1oZ/e+rDgTS6kJVdYhsnQK0z8hCDSHvBcFclBWfmT1SnMehlN0913sQ7 GU1m/2xnDv8OVis3SY6SYpK4lcRgM6Dn97JO1JtMu9PXCg56bTfSSE/WGnZSahtN BOGXweozbj3VWmq/IIUWa1stWGMPsfU+3Rtg5dIXOUU52knv2Q7rTnX1u50x0RgA 7ND0EqaR8EL7MlPl85SRRQ1BKbbOF1RZWAwLtGqwYnfzldZLoDjZPdZ6BG5I/yVQ h5JIsT4eVW0JMEsu8jhk9R6w84KwMg== =XgeV -----END PGP SIGNATURE----- --dzZ2XdGmVBkCOrh6--