Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp336467ybl; Wed, 29 Jan 2020 01:14:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxOCITqf3PLZHkdLjQZebHLhP7jrvzg9zyBNB2aGiburKBBLkC6YLYV0XaOYhMD09blBuU9 X-Received: by 2002:aca:ad11:: with SMTP id w17mr5937110oie.85.1580289257528; Wed, 29 Jan 2020 01:14:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580289257; cv=none; d=google.com; s=arc-20160816; b=OJd0rYiRqH1GtizQti4OJOGPfZT2v3bMcCV/LLTDK4Uqs8CG5fPPUPyky5/iB0k5jv ZutV4vnMkGqio7hjYc9g+eSs+OtCvZoXnXeduc2DbqIMS0pz/781zkd35bPRaXMV3mG3 P8Kz12Thgts0lvGxNbSMHPr8cZeJXsVZ8Ds9XzDCRdmRgh0MFBsXIxh6E4AGMlSoyTV4 vOhvngiuXMJ8/J2ov+89715AbohxiuY7NIkv3D/sLUS0Z9B993t3W4mzqLxgqSsWj3zn +GUTa4eDrnhO+u0SCtZoEt9LjQa0oXfKtvO0G9g438Cr8kne6hGHcJSn/YrMjO5wzlQN eJrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=qrygNuanVNFn2dafEwaOoexxos726aQ9sTC3dappZCU=; b=z9s1mYAUuQURMuLI8I4SD/4WKH2YCsFCqDOJLkdkTF+vksgtc4nHv6mPqnKGahxLoJ d3MguPy8QdXUQmxEyG/tFRy1vCjruvA+ZGRN8ZdsS0CG4zRq6dvSGlz0NhcQV29YfApZ MSvKL2i0OBxdiqFhURj7ZujivwoS16R2rpDJwl3WX59C7an5Taz3nD8HU9Pe10Gs0avH aLSkLQmAFYQ3wfZBCOPqfwJcQC6I6zAStVzOA2Dk/VKR8R/zJuVpBUuN5ayY1Q1MCJ/5 N/f3cqTiDoFa1PxmDXmZHPLqZsDWZSecaym+aafoKl0+Y4eO1mTOliV/EeSYd2jhYynF Wvkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o011yhgI; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si883382otp.273.2020.01.29.01.14.05; Wed, 29 Jan 2020 01:14:17 -0800 (PST) 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=@kernel.org header.s=default header.b=o011yhgI; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726178AbgA2JML (ORCPT + 99 others); Wed, 29 Jan 2020 04:12:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:42122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbgA2JMK (ORCPT ); Wed, 29 Jan 2020 04:12:10 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C371920708; Wed, 29 Jan 2020 09:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580289129; bh=3PbAV8xHa5J1shODJC/9vqbomQlLbIG5XwG5BrUPB+s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o011yhgIai4vAfp6DxIAk6OX++mtFKDDNVaRJUxPNVXWQEo1PtH3nX+IBfs8/cv/K MbYVdQ1hHusvG/nXheJpX9kJT+rEYrkI/r+P5TFKNy+LfCv8u/D8miQ0aR/QyCcq8Y xV7xzBc3J7YDnUoPjSJYKh3+ygKNl6TEg0vecg/8= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iwjOK-001zHw-1b; Wed, 29 Jan 2020 09:12:08 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 29 Jan 2020 09:12:08 +0000 From: Marc Zyngier To: JaeJoon Jung Cc: Yash Shah , atish.patra@wdc.com, wesley@sifive.com, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, bgolaszewski@baylibre.com, Palmer Dabbelt , sachin.ghadi@sifive.com, linux-gpio@vger.kernel.org, Paul Walmsley , linux-riscv Subject: Re: [PATCH] gpio/sifive: fix static checker warning In-Reply-To: References: <1580189061-14091-1-git-send-email-yash.shah@sifive.com> Message-ID: <934410721310a3107e1d9d2600ec438a@kernel.org> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.8 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: rgbi3307@gmail.com, yash.shah@sifive.com, atish.patra@wdc.com, wesley@sifive.com, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, bgolaszewski@baylibre.com, palmer@dabbelt.com, sachin.ghadi@sifive.com, linux-gpio@vger.kernel.org, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org JaeJoon, On 2020-01-29 01:27, JaeJoon Jung wrote: > Because SiFive FU540 GPIO Registers are aligned 32-bit, > I think that irq_state is good "unsigned int" than "unsigned long". > > I refer to SiFive FU540-C000 Manual v1p0 (GPIO Register Table 103) > as "Only naturally aligned 32-bit memory accesses are supported" You realize that we're talking about variables here, and not hardware registers, right? > when you use assign_bit(offset, &chip->irq_state, 1), > offset is 32-bit. And? assign_bit takes an "unsigned long *" as a parameter. irrespective of the size of long on a given architecture, by the way. > I prefer to use bit operation instead of assign_bit(). > > u32 bit = BIT(offset); > chip->irq_state |= bit; which is not what assign_bit() does. > If you use this code, you do not use the assign_bit() and > need not change irq_state data type. Or we can use the correct API and not introduce additional bugs, which your suggestion above would lead to. > There are many improvements in my works for drivers/gpio/gpio-sifive.c. > I hope to check my attached source file. That's not how we submit patches to the Linux kernel. I suggest you read the documentation on how to do this. Thanks, M. -- Jazz is not dead. It just smells funny...