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 EE674C433FE for ; Wed, 23 Mar 2022 08:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242880AbiCWIvF (ORCPT ); Wed, 23 Mar 2022 04:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242799AbiCWIvD (ORCPT ); Wed, 23 Mar 2022 04:51:03 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D661A710EB; Wed, 23 Mar 2022 01:49:30 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:41174.1449576847 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id D4AA810023D; Wed, 23 Mar 2022 16:49:18 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-b7fbf7d79-9vctg with ESMTP id f13d8488257c43b0a5381e0c8ff61c77 for robh@kernel.org; Wed, 23 Mar 2022 16:49:29 CST X-Transaction-ID: f13d8488257c43b0a5381e0c8ff61c77 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: <23c0f1ec-bc7b-df38-62e9-0c9f2f21f6d3@189.cn> Date: Wed, 23 Mar 2022 16:49:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v11 7/7] drm/lsdc: add drm driver for loongson display controller Content-Language: en-US To: Rob Herring Cc: Maxime Ripard , Thomas Zimmermann , Roland Scheidegger , Zack Rusin , Christian Gmeiner , David Airlie , Daniel Vetter , Thomas Bogendoerfer , Dan Carpenter , Krzysztof Kozlowski , Andrey Zhizhikin , Sam Ravnborg , "David S . Miller" , Jiaxun Yang , Lucas Stach , Maarten Lankhorst , Ilia Mirkin , Qing Zhang , suijingfeng , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel test robot References: <20220321162916.1116541-1-15330273260@189.cn> <20220321162916.1116541-8-15330273260@189.cn> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/3/23 04:49, Rob Herring wrote: >> +/* >> + * ls7a_gpio_i2c_set - set the state of a gpio pin indicated by mask >> + * @mask: gpio pin mask >> + */ >> +static void ls7a_gpio_i2c_set(struct lsdc_i2c * const li2c, int mask, int state) >> +{ >> + unsigned long flags; >> + u8 val; >> + >> + spin_lock_irqsave(&li2c->reglock, flags); > What are you protecting? Doesn't the caller serialize calls to these > functions? > This driver is ported from my work from my downstream work. Maxime also ask this question before, but i did not answer. He is right, protect single register access is not necessary. uncached access have done the job itself. so i remove it in V11 of my patch set. There are two way GPIO emulated i2c, I want the code between spin_lock_irqsave(&li2c->reglock, flags) and spin_unlock_irqrestore(&li2c->reglock, flags); finished in a atomic way, without any disruption. The two i2c should not have any influence each other. I write it by gut feeling, and luckily it works very well in practice. 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E252BC433FE for ; Wed, 23 Mar 2022 08:49:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 308C210E4A9; Wed, 23 Mar 2022 08:49:33 +0000 (UTC) Received: from 189.cn (ptr.189.cn [183.61.185.103]) by gabe.freedesktop.org (Postfix) with ESMTP id 46C1310E4A9 for ; Wed, 23 Mar 2022 08:49:31 +0000 (UTC) HMM_SOURCE_IP: 10.64.8.41:41174.1449576847 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id D4AA810023D; Wed, 23 Mar 2022 16:49:18 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-b7fbf7d79-9vctg with ESMTP id f13d8488257c43b0a5381e0c8ff61c77 for robh@kernel.org; Wed, 23 Mar 2022 16:49:29 CST X-Transaction-ID: f13d8488257c43b0a5381e0c8ff61c77 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Message-ID: <23c0f1ec-bc7b-df38-62e9-0c9f2f21f6d3@189.cn> Date: Wed, 23 Mar 2022 16:49:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v11 7/7] drm/lsdc: add drm driver for loongson display controller Content-Language: en-US To: Rob Herring References: <20220321162916.1116541-1-15330273260@189.cn> <20220321162916.1116541-8-15330273260@189.cn> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Qing Zhang , David Airlie , Jiaxun Yang , linux-kernel@vger.kernel.org, Sam Ravnborg , kernel test robot , Krzysztof Kozlowski , Dan Carpenter , devicetree@vger.kernel.org, suijingfeng , Thomas Zimmermann , Roland Scheidegger , Andrey Zhizhikin , dri-devel@lists.freedesktop.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, "David S . Miller" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 2022/3/23 04:49, Rob Herring wrote: >> +/* >> + * ls7a_gpio_i2c_set - set the state of a gpio pin indicated by mask >> + * @mask: gpio pin mask >> + */ >> +static void ls7a_gpio_i2c_set(struct lsdc_i2c * const li2c, int mask, int state) >> +{ >> + unsigned long flags; >> + u8 val; >> + >> + spin_lock_irqsave(&li2c->reglock, flags); > What are you protecting? Doesn't the caller serialize calls to these > functions? > This driver is ported from my work from my downstream work. Maxime also ask this question before, but i did not answer. He is right, protect single register access is not necessary. uncached access have done the job itself. so i remove it in V11 of my patch set. There are two way GPIO emulated i2c, I want the code between spin_lock_irqsave(&li2c->reglock, flags) and spin_unlock_irqrestore(&li2c->reglock, flags); finished in a atomic way, without any disruption. The two i2c should not have any influence each other. I write it by gut feeling, and luckily it works very well in practice.