Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4138520pxf; Tue, 6 Apr 2021 08:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFmxcXLMVl2zR4TMpC56YBWeVBMU+GcaQ1DNiCaaD1lULHVbBZ/c8aX2Avgl5i4LDqdCob X-Received: by 2002:a6b:5905:: with SMTP id n5mr24436338iob.90.1617724053767; Tue, 06 Apr 2021 08:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617724053; cv=none; d=google.com; s=arc-20160816; b=GaTZN4OsJdAO4+5TMsPrezj/Td7+oguGwWfsQOtApGSlXa1N38izl8NttdPVh9N1w9 I1b6kPHuGpunJehT6O81BKuViCt/eP2l3Z/uo/jXRRO1driQXUZmnUPXfY9ZTw0RDiYS GQ7u7Muip0odCiYXCH4jGYiVCQ71BpcgBf4whFfcFXztCDNpCRuWsASmPwOgfr/blLx6 V2q4YC98malrLZbM0HtTON4qeXnfX1/3IlkKZPI+HftfbWTtopWMyJlim+22hxUD553o MnooH9upXOSxfFl51RSk9tOoKuIhma1z5bZxGLjEun9pzBC37STNnSyJ4r+Zd0lOhUdD MPCA== 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:dkim-signature; bh=5CPtl5V/ThmsM1Tl9GeocLPhP7+ievb78V+ESPZGtBo=; b=K7MELCa9+I9/8PjiTbjkgDbawIcGJ3YncJW5GytUu2a+9ALGzhv5KEnFII70n+F0f2 90CLGey2Lme5BjW0cyyKla3s2La6ZpkCN1zPnWT2QNDqddaxkMTHU1b+fWdVO0b6I5Sw Twe/WjtGUFIyqqcdzAubuPxwZ2H2l1Ktz+52P9UQzA974OYb+alhZ1cKfk5cBdra/JGS XuTGfPcSOxA1Exwi1gYIf+xyLPsvzvwWxQjqwIp3NhDtgQxoPr3VAs0z+Js27VW0plSK R6w4scAGZYEC7K+cvlDLchVLwE0riKoy9yktXAeQKlIDb5rpOZAPxfJzKc4hXiqBhHV6 XlOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzWorqWM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si6520594ioq.81.2021.04.06.08.47.21; Tue, 06 Apr 2021 08:47:33 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QzWorqWM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbhDFE7m (ORCPT + 99 others); Tue, 6 Apr 2021 00:59:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:56816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbhDFE7m (ORCPT ); Tue, 6 Apr 2021 00:59:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6714361222; Tue, 6 Apr 2021 04:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617685174; bh=tIomgEeIuH8P7ze0EpjBfN/KC3eWyiZsxls9MV18GGA=; h=From:To:Cc:Subject:Date:From; b=QzWorqWMOHmMsSEBLrfFvgLArOfX2Ekm1OfbI7eT+hQDLXp+/NUlfq9OOrqg5arG7 CsqsYBpT5RT0YER+DPmVgJOtjhFlOcGrAAQxrJhEoGHutyjzkTyOXNQEWV+hqM6xvP 1MlTLEb/SM3VcUSvY5NmPb1ZNbRZBvutSi1eJZzWSzYORgyXInl0B2F9/CJq0ZrhhO Oewu+cSikyq4TH1ccc9oSRnlrMDh7yA+DC5gKkUY7j28zojOL7UivehwjX+hI6ielV VQ/p977dqnGomY7HvP2LlWMEhvNllTQfD9UKZFLyrwE7T1uWM2MpKV8bcpq40RA3q3 mL4Piw5bH9A6A== From: Gao Xiang To: linux-parisc@vger.kernel.org, Helge Deller Cc: Liam Beguin , linux-kernel@vger.kernel.org, Gao Xiang Subject: [PATCH] parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers Date: Tue, 6 Apr 2021 12:59:29 +0800 Message-Id: <20210406045929.30331-1-xiang@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang commit b344d6a83d01 ("parisc: add support for cmpxchg on u8 pointers") can generate a sparse warningi ("cast truncates bits from constant value"), which has been reported several times [1] [2] [3]. The original code worked as expected, but anyway, let silence such sparse warning as what others did [4]. [1] https://lore.kernel.org/r/202104061220.nRMBwCXw-lkp@intel.com [2] https://lore.kernel.org/r/202012291914.T5Agcn99-lkp@intel.com [3] https://lore.kernel.org/r/202008210829.KVwn7Xeh%25lkp@intel.com [4] https://lore.kernel.org/r/20210315131512.133720-2-jacopo+renesas@jmondi.org Cc: Liam Beguin Cc: Helge Deller Signed-off-by: Gao Xiang --- arch/parisc/include/asm/cmpxchg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h index cf5ee9b0b393..84ee232278a6 100644 --- a/arch/parisc/include/asm/cmpxchg.h +++ b/arch/parisc/include/asm/cmpxchg.h @@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) #endif case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int)old, (unsigned int)new_); - case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); + case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff); } __cmpxchg_called_with_bad_pointer(); return old; -- 2.20.1