Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp710829yba; Fri, 5 Apr 2019 15:51:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVdtDsAcdQXzbd5K79J6VXTsRscl4/L8sApJ89pDSqV2V4Y1VUX3aAviFpVN8zB3Kxd2KW X-Received: by 2002:a17:902:248:: with SMTP id 66mr15204586plc.286.1554504665846; Fri, 05 Apr 2019 15:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554504665; cv=none; d=google.com; s=arc-20160816; b=XPFcJSFBmoAtdSG1sU2x0C6Ox80Pr3q/E7FUQ4HpCIMEVNowPpXUJzcWbJfyTU3thm +zwR/OOTqgiAy+HCgvSfL5st9aDYcM8D+I39Tv2uijgBbMg8IHix1P6zodaU4dRj9C/D +J44pTZG5EjaBbfEKGy8qDfUNAkEpXEhnUpurFDLyDuzMb5zhuarVFXiKs4+OM4z59Zz 2YX9d6jFreqksdo5Yok0CXoc+irFcA4++Xp/A1KLrtlM3EfFH8V/eTQXIBGMdhtvURsE WAa2M958F/T0OrTewbotVGI1xMSgi748ApEyIKbTGYekcKjjTzbauZH8s3XJoJeIY5OR 4yXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=WZyhCqqHVZgZD5mC+F681yCOX1N1HxcM8DUVwE70YdU=; b=nnqT09YbBZx604Klt95BBBnnA7usftb6+KYFUNLceLXd5zskeCDj2XRQk/YEtZbVeC iHTmf8KYAXfqVM6ztFwBCBWwEqLQa9MXq2g76UNwc8sO6kvOqspeHRNfLwgmVKkuzB3C aDJjXzoQ0w3JIPj3L5ALhWhifcU0R5IAcaFqQj03QZBBcjU4VpKHLQ01J/YT+vv2SDlb hYmOqtOdRkW3r3sb8WU7+xIJnPs0cHZ11nFCXH971GI8O8MNaiHEV/RY6JCZypY9Ntre XMHUC/F/LFodoc3RFcpubEUt9662rroHOPqku3o8xuzDqZXmVz1BAULr5guoF4yrPMho yKsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQmvzlSj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si20309735plb.330.2019.04.05.15.50.50; Fri, 05 Apr 2019 15:51:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qQmvzlSj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbfDEWuQ (ORCPT + 99 others); Fri, 5 Apr 2019 18:50:16 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41178 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726206AbfDEWuP (ORCPT ); Fri, 5 Apr 2019 18:50:15 -0400 Received: by mail-pf1-f193.google.com with SMTP id 188so4039441pfd.8 for ; Fri, 05 Apr 2019 15:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=WZyhCqqHVZgZD5mC+F681yCOX1N1HxcM8DUVwE70YdU=; b=qQmvzlSj13+4WjjF4FulxWOd4AqkIpbBLYq+x5xoHzacVUHBQVX1SuxsSfnswUO6iG 2xGiQ7EZBoa8jGsNgxHafxilBaix5OjIhGx1Fop6oVWkdUZjQtxMhKnVaNl67KuZVthj jLrKJ+i1g2atA6hFeia3AmJSIjSTxkzannh0GUuZL2Y+XVukGsmDqHuRUOnLGGzljbj2 IW8A08BmXXy7UJW/5ku7UUQ1uNbupiQOV7GTEcC3v35il8wv6DZiayQxipQXMRuEzsC8 B2buMe0LDFg26vmYhab2Pu3zQ2roe4y7kc4slIj6r1r1i8ygtrY77SVBpn67B+M8OwCx BNBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WZyhCqqHVZgZD5mC+F681yCOX1N1HxcM8DUVwE70YdU=; b=czU46iJMR/BUicXUx0jpxF35neIJx/ejetYhLPt1ELNg7v6Z9vYpFQrRr7BC8XJJzc OlSk43zxv+pXv3L73xvUZd+HE9WVklT0ROEYlPahQMe1m1dsFVMfBpjpJ1ekQyM9XBZC dXZHmU625oVGjIto1ybmlr5bVRccayM06xVj3DJYyI/zEV0I9pZ4qF2ktC9mnaEw213T RI3WXNpwjVbWWZhc09bYpSDRn7pgOok79rVumiWUlQ/ygxOn/CRKKuYFVirRvNdXj+G4 1vE4vN2lItSQY9sRYzS0rWeFEqtUamqmqUpiD1OQXfTPn9nZeDtEPnyHT4olWyoUlIaG WK/A== X-Gm-Message-State: APjAAAX5bu6u2VZIdxDM6jgqj843KU23FhJEieGxaUhePkSubbLqx1rd 65I+xzHXaCgtyu9fwW/qTt6MkQ== X-Received: by 2002:a63:6f0a:: with SMTP id k10mr14373126pgc.78.1554504614814; Fri, 05 Apr 2019 15:50:14 -0700 (PDT) Received: from [10.156.37.38] ([116.84.217.55]) by smtp.googlemail.com with ESMTPSA id m7sm35159407pgg.62.2019.04.05.15.50.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Apr 2019 15:50:14 -0700 (PDT) Subject: Re: [greybus-dev] [PATCH] Staging: greybus: Fix spinlock_t definition without comment To: Dan Carpenter , Madhumitha Prabakaran Cc: devel@driverdev.osuosl.org, elder@kernel.org, johan@kernel.org, linux-kernel@vger.kernel.org, greybus-dev@lists.linaro.org References: <20190405200046.20600-1-madhumithabiw@gmail.com> <20190405205304.GS32590@kadam> From: Alex Elder Message-ID: Date: Fri, 5 Apr 2019 17:50:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190405205304.GS32590@kadam> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/5/19 3:53 PM, Dan Carpenter wrote: > On Fri, Apr 05, 2019 at 03:00:46PM -0500, Madhumitha Prabakaran > wrote: >> Fix spinlock_t definition without comment. >> >> Signed-off-by: Madhumitha Prabakaran Madhumitha, the reason one would want a comment associated with a lock field in a structure is to get some understanding of why it's needed. Saying "protect structure fields" is not enough, because that can pretty much be assumed, so a comment like that adds no value. Looking at the code, you can see the lock field protects the connection's operations list. It also appears to be needed for accessing the state field (reading or updating). Given that, a better comment might be: spinlock_t lock; /* operations list and state */ >> --- drivers/staging/greybus/connection.h | 2 +- 1 file changed, 1 >> insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/greybus/connection.h >> b/drivers/staging/greybus/connection.h index >> 5ca3befc0636..0aedd246e94a 100644 --- >> a/drivers/staging/greybus/connection.h +++ >> b/drivers/staging/greybus/connection.h @@ -47,7 +47,7 @@ struct >> gb_connection { unsigned long flags; >> >> struct mutex mutex; - spinlock_t lock; + spinlock_t lock; /* >> Protect structure fields */ enum gb_connection_state state; > > What does the mutex do then? Why can't we just use the spinlock for > everything? The mutex needs to be held during enable and disable of a connection. Johan might be able to give you a more complete answer but these operations (or at least the enable) need to block, so can't hold a spinlock. -Alex > I did glance at the code and it wasn't immediately obvious to me. > > regards, dan carpenter > > _______________________________________________ greybus-dev mailing > list greybus-dev@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/greybus-dev >