Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2715988yba; Mon, 8 Apr 2019 03:10:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQg5fXp6jEd6jdvkCpqdphH5p3Vs0ryO6HAoW7iCUk8ZXTpjU+ut2NqPR22+BCYVycDElJ X-Received: by 2002:a63:e004:: with SMTP id e4mr27885896pgh.344.1554718240923; Mon, 08 Apr 2019 03:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554718240; cv=none; d=google.com; s=arc-20160816; b=YKPTdM52tmFfxi8I+SvgVvcAzc45kckSK31X5o1zpddkN8BoZ439uKf+nQlSbhMfYc 3fbkUYiGRiN35ZSlmmR3j9JdNbiBz8RMqxtJtxs3tom0YsQvL+cs8qtp4nZ/6YYhZhRz hKplnZ83SGrQipcYVdRrFVkgYBykn00WPzXKzf1gjQyaNtZg3hYT0zbsH3dPcN4RMKNG nBRdksaqv5nYm7NRk43e2if7jwJFT2k+H/aYKolghPCGwW0/Q9wir7h7RTY2esaeAWwd 38N8WP3uUPJRCHNA/3j5ecQ0tU1VqCniVL2oTVGkR9vqgPkV+rmjagjEtDv+oPrZF2lH 2OHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=L+MGTwtJTWfuTK6Yq3PZwkE9ob9+dwa1Ee2t3jHVkIE=; b=X2uB46XfxkIcaWTpDKXYbmTHUC2CPlcLT8DZDoXISVCyuvAnNz8GOHR0HX+w7lR56I Kp924JsPAZMEvtaAHEw3hqKxgheAe9OnB4SmW3ENoghTVAcwAHorX4liN1YyoPWzCro7 22ZzULMfDsbA/r1BzD5YsZB1r+pJKYJ/LqC3lHHohV7ZI+W3tAOGpI39d7Kw9sq/ZT5R 2jCByTAli9VpZz1vi01k/WUPelu60jFPoy4ba4ZJitCKBQP/iffhjIiCjxeOSNqMR5vb VlqFHHxRyOxQc3RgMZFlLpfYWyrzoh4TfYyer0Q6r1WApsgZ3Bs+6jiXc2DAqRFPQgI2 pqOA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si26830452pfn.30.2019.04.08.03.10.25; Mon, 08 Apr 2019 03:10:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726240AbfDHKJv (ORCPT + 99 others); Mon, 8 Apr 2019 06:09:51 -0400 Received: from mga14.intel.com ([192.55.52.115]:16373 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbfDHKJu (ORCPT ); Mon, 8 Apr 2019 06:09:50 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 03:09:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,324,1549958400"; d="scan'208";a="138453667" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga008.fm.intel.com with ESMTP; 08 Apr 2019 03:09:48 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hDRDn-0006e0-HG; Mon, 08 Apr 2019 13:09:47 +0300 Date: Mon, 8 Apr 2019 13:09:47 +0300 From: Andy Shevchenko To: Mika Westerberg Cc: Chris Chiu , heikki.krogerus@linux.intel.com, drake@endlessm.com, linus.walleij@linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com Subject: Re: [PATCH] pinctrl:intel: Retain HOSTSW_OWN for requested gpio pin Message-ID: <20190408100947.GI9224@smile.fi.intel.com> References: <20190408042103.3804-1-chiu@endlessm.com> <20190408074106.GC3622@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190408074106.GC3622@lahna.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 08, 2019 at 10:41:06AM +0300, Mika Westerberg wrote: > On Mon, Apr 08, 2019 at 12:21:03PM +0800, Chris Chiu wrote: > > +static void static u32 (see below why) > > +intel_gpio_update_pad_mode(void __iomem *hostown, u32 mask, u32 value) > > +{ > > + u32 curr = readl(hostown); > > + u32 updated = (curr & ~mask) | (value & mask); > > I think here we should first complain if the expected ownership is not > correct. Warning or info level probably enough. It is easy to achieve, something like if ((value ^ saved) & requeted) dev_warn(...); See also below. (I had mentioned this earlier) > > + return writel(updated, hostown); writel() is a void function, this is wrong. We need to return curr instead to make above working to issue a warning message. > Also if the pin is not requested and not changed we should not touch the > register. I don't think it brings any value here, if mask is 0 we will write back the same value we read. > Otherwise this looks good to me. -- With Best Regards, Andy Shevchenko