From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E804C433EF for ; Wed, 16 Feb 2022 01:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245433AbiBPBYR (ORCPT ); Tue, 15 Feb 2022 20:24:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240360AbiBPBYN (ORCPT ); Tue, 15 Feb 2022 20:24:13 -0500 Received: from mail-m17640.qiye.163.com (mail-m17640.qiye.163.com [59.111.176.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1257013CDD; Tue, 15 Feb 2022 17:24:01 -0800 (PST) Received: from [172.16.12.40] (unknown [58.22.7.114]) by mail-m17640.qiye.163.com (Hmail) with ESMTPA id D921E540269; Wed, 16 Feb 2022 09:23:58 +0800 (CST) Message-ID: <0ee7ab71-5d01-58e2-baf7-4dd41455b377@rock-chips.com> Date: Wed, 16 Feb 2022 09:23:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH 2/6] spi: rockchip: Preset cs-high and clk polarity in setup progress To: Mark Brown Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org References: <20220211034344.4130-1-jon.lin@rock-chips.com> <20220211034344.4130-2-jon.lin@rock-chips.com> <4222ce7d-a1e3-1728-fec2-976946b06ba9@rock-chips.com> From: Jon Lin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUIaGUJWSR9NTkgdShgfHU geVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NzI6Eyo4ST5IOBZLAUMVCC9N MjowCS1VSlVKTU9PQkxPTUhCSEtDVTMWGhIXVREUFVUXEhU7CRQYEFYYExILCFUYFBZFWVdZEgtZ QVlOQ1VJSVVMVUpKT1lXWQgBWUFJQ05MNwY+ X-HM-Tid: 0a7f002107c5d995kuwsd921e540269 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/2/15 20:36, Mark Brown 写道: > On Tue, Feb 15, 2022 at 11:00:54AM +0800, Jon Lin wrote: >> 在 2022/2/14 20:49, Mark Brown 写道: > >>> As covered in the documentation setup() for one device may run while >>> another is active, therefore if multiple devices are configured in the >>> same register you should use a lock to ensure there can't be multiple >>> writes. Note that the above appears to not just be setting the mode but >>> also the chip select so if you've got two SPI_CS_HIGH devices then >>> they'll both be going in and separately setting cr0. > >> Is the io_mutex in function spi_setup is good enough? > > It's not supposed to be for that but looking at the code quickly I > *think* setup() is never called with io_mutex held so it might well be > fine - you should double check though. If not you'd need to add another > lock in your driver data. 》setup() is never called with io_mutex held I think so. and I think the io_mutex is enough for me.