Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10460376imu; Thu, 6 Dec 2018 01:14:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UFkijJaSPpcm/LDPI3s2a2WM5hN8IHxpjmoEjIy2PYrftgNRodAdmMef2CpyafNdboSK5t X-Received: by 2002:a17:902:5066:: with SMTP id f35mr27664811plh.78.1544087696746; Thu, 06 Dec 2018 01:14:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544087696; cv=none; d=google.com; s=arc-20160816; b=tNNsVh8Rkh7plsZttw9owV9TD+ZxGAhEZO7StEfz/8+5WTGFf1HCpXeAANxb2RFFAp NnjtVOBvWMt06alkzw6nKrpsCBlSaoH82uYNrg9LWJRzaCX+sGDusPCPDboTrnq+BOmQ hLBgk0V8BzH+gPJlQvn+SYCd0wfYqW0bBgqkk3TzsssoG1HHrRjkAJFYM6KnisHQlQzo IWOwsdlBdOLEczRbZd+H7BDfvqGVZa0GxBg546QYjIjDFrIIM5e2nSLkCEnZy2GXOPhC npqkHWp6B72CDXisel/BjlQknU8p0RRgDWlm3hSPqCBnGTKNyPJiw4d3ZalJUCa1s/vp Bh4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Ml3kYaXG5ymCHTISsJI3Pi4MPA5abCZU4bJR0MznsKo=; b=Hp4g2dil3/OfDg0uLlS0cF4JQUOPzsd12MCT1BoMty2zEAvhMgQ6sgZ5I9oxX5wToB 1kXMLN9wv5V25LwKlufx+46hO+hcwSHexxpYUgqkm/2wKxYFf6eylkd79Oyrnrl/kMuC KLRBXqJJSTw7PokKTYN8dqEOaQxUBlD3poUk1GuDB1dhQipYMCg1aVShfMinCHTgz48d iK+CLvA7BkREyOHM21A0yPYjFgl0/AfstgaTIlFUskIKz82U4ae/D6CHgxwuKLSM5GlG G2W6U9GM/riT3KrN2NN4zF0onM4DorX1HSvXTXpNif6sC8byjQZX4d0MGmf1wsWpGwzW 8amA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si20742240pgl.25.2018.12.06.01.14.41; Thu, 06 Dec 2018 01:14:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729346AbeLFJMZ (ORCPT + 99 others); Thu, 6 Dec 2018 04:12:25 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:37789 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727575AbeLFJMY (ORCPT ); Thu, 6 Dec 2018 04:12:24 -0500 Received: by mail-vs1-f68.google.com with SMTP id h18so13862840vsj.4; Thu, 06 Dec 2018 01:12:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ml3kYaXG5ymCHTISsJI3Pi4MPA5abCZU4bJR0MznsKo=; b=dMzXEmcTxbfi6b7JCPwq1lusua8XkZgglbeokvAh8DCGTsZr3YwubPxgRfuNYw3cmC 06Jcot0iDPvcMPk3XyDl/YCC936uSQdSodTeE4pqeDNk9IypEy8QqPz3vvQNYHa9lWmR icMPk1kV4DR2z2UQXSn1DIgmsUkbFgPRb9BGg69c95JmnVBBnT4qDzOT5+8Y/Tqi1Bmq b9W0OF+4T6Iqcob5ulaU58YLX6snigDMXLOi4TCsRCUcf9V4oAna0Gv7s5e74a6ijQr8 UA6huKeBi3vrEbduRUJ2IE8Qc72EhwGH33DoBDZuitayyOHXnThGM0k09gBuobaTziOT jPOA== X-Gm-Message-State: AA+aEWYV+Z9QngHIW8elfoD11ZyrBgCNG1DphJhsqFYDOH3Q8u48Rvhz rZF4rjvS1fAb5QpyMuTSrR2zs4iIJmCVtgZQbCE= X-Received: by 2002:a67:b60d:: with SMTP id d13mr12512324vsm.152.1544087543711; Thu, 06 Dec 2018 01:12:23 -0800 (PST) MIME-Version: 1.0 References: <1543828720-18345-1-git-send-email-masonccyang@mxic.com.tw> <1543828720-18345-2-git-send-email-masonccyang@mxic.com.tw> <84e3c55b-687e-28f6-0a7c-1c48c822ef05@gmail.com> In-Reply-To: From: Geert Uytterhoeven Date: Thu, 6 Dec 2018 10:12:11 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver To: masonccyang@mxic.com.tw Cc: Marek Vasut , Boris Brezillon , Mark Brown , Geert Uytterhoeven , Simon Horman , juliensu@mxic.com.tw, Linux Kernel Mailing List , Linux-Renesas , linux-spi , zhengxunli@mxic.com.tw Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mason, On Thu, Dec 6, 2018 at 8:31 AM wrote: > > >> Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver > > >> > > >> On 12/03/2018 10:18 AM, Mason Yang wrote: > > >> > Add a driver for Renesas R-Car Gen3 RPC SPI controller. > > >> > > > >> > Signed-off-by: Mason Yang > > >> > + xfercnt = xferpos; > > >> > + rpc->xferlen = xfer[--xferpos].len; > > >> > + rpc->cmd = RPC_SMCMR_CMD(((u8 *)xfer[0].tx_buf)[0]); > > >> > > >> Is the cast needed ? > > > > > > yes! > > > > Why ? > > Get a compiler warning due to tx_bug is void *, as Geert replied. > > Using get_unaligned(), patched code would be > --------------------------------------------------------------- > rpc->cmd = RPC_SMCMR_CMD(get_unaligned((u8 *)xfer[0].tx_buf)); > ---------------------------------------------------------------- Using get_unaligned(0 is a bit strange for accessing a single byte quantity. Please keep the normal pointer dereference (including the cast). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds