Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4998608pxj; Tue, 22 Jun 2021 12:45:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTzF6HoSnIihqjJ9Et9E5M7oMvFUetlxnuulo/RvntuvZNhkwpbsNYZsG+TJeNqCRrJ96o X-Received: by 2002:a02:c808:: with SMTP id p8mr5636985jao.109.1624391151198; Tue, 22 Jun 2021 12:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624391151; cv=none; d=google.com; s=arc-20160816; b=cE3hGjipDzFrt2PSG29P/Q9QR5eFsxC4C8hCI4sc54R783poQT+ClCT0OBXDv4EFFB b170S9Z0RMmWZwugucVXYuMr7nP2sDzdRJtoxY6RsCUUn36R4+0+8eVvKFMqx7Q/7UhA MzQ8BhQvTt/LI1hGLdFUQZV1CAcvETSVHEv55Y1I4ddCHU3t8Y8Vk28+pkf3Ju6p28aW WCw8FwQJ0eILyiWM56kujXQdGX+oHNbMuYoW2iRJhHVu+lXndW4f6hLXnfrqh6Yt29MM QtJu14Epdy72D7Uju6T//JuE7+z0WsIzbIxc32AkNvkccRb2rco3A8MfQX65amUA2KvJ ZqrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=MCiCPVH0tgC2vdaFvMdUWoJLP2ybtoqDH3RG35Lx6co=; b=shcYiPmf9ZUnW7z4e6C793GUj/i2Q8sJvIO3gjiTBwwxHP3HfVE70fmvpdktEdh+JK Q05CtPuDuLPauzhuIjgQHDb7X08Cr+qpgHy7kF5hu1OZZQ8qS7l3W96XjURFdhRHcwUo Cu+gzwqAsZhDCskDVS1Q08iNhUltlD2AHkrUyReY23ijqmCT3TgxWkVQiDrulRl5NrG5 dIknzj3nsmm8aDkETh1s5o8HG+RpzfPEGFP4yXnBdkQZaC8lfi6j/1a0SHp5r/j0Nesd WrpDyBUowLaaKuILgYo2ar25/IqQWnsdj3yQuWJBacOA83WhbC4xnbWayexrZ5GN9i/J /7Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si24668894ioq.102.2021.06.22.12.45.38; Tue, 22 Jun 2021 12:45:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232776AbhFVToY (ORCPT + 99 others); Tue, 22 Jun 2021 15:44:24 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:42080 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbhFVToN (ORCPT ); Tue, 22 Jun 2021 15:44:13 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d82 with ME id LKdq2500821Fzsu03Kdq5B; Tue, 22 Jun 2021 21:37:52 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 22 Jun 2021 21:37:52 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: pawell@cadence.com, gregkh@linuxfoundation.org, peter.chen@nxp.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] usb: cdnsp: Fix the IMAN_IE_SET and IMAN_IE_CLEAR macro. Date: Tue, 22 Jun 2021 21:37:48 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IMAN_IE is BIT(1), so these macro are respectively equivalent to BIT(1) and 0, whatever the value of 'p'. The purpose was to set and reset a single bit in 'p'. Fix these macros to do that correctly. Fixes: e93e58d27402 ("usb: cdnsp: Device side header file for CDNSP driver") Signed-off-by: Christophe JAILLET --- This patch is speculative. It is not tested. Please, review with care. Actually, the usage of these macros is: readl(somewhere) set or reset the IMAN_IE bit write(somewhere) So it is likely that we want to preserve the other bits read. Otherwise, the code could be much simpler. --- drivers/usb/cdns3/cdnsp-gadget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h index 783ca8ffde00..f740fa6089d8 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.h +++ b/drivers/usb/cdns3/cdnsp-gadget.h @@ -383,8 +383,8 @@ struct cdnsp_intr_reg { #define IMAN_IE BIT(1) #define IMAN_IP BIT(0) /* bits 2:31 need to be preserved */ -#define IMAN_IE_SET(p) (((p) & IMAN_IE) | 0x2) -#define IMAN_IE_CLEAR(p) (((p) & IMAN_IE) & ~(0x2)) +#define IMAN_IE_SET(p) ((p) | IMAN_IE) +#define IMAN_IE_CLEAR(p) ((p) & ~IMAN_IE) /* IMOD - Interrupter Moderation Register - irq_control bitmasks. */ /* -- 2.30.2