Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6821222yba; Wed, 1 May 2019 21:53:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLdH8jePHRWmWgszG8iDp1YP0Hx99S6aP75JjruYaaX4sp+tSfnrXWl7Eb8gvEjvKq9CZ/ X-Received: by 2002:a63:fc62:: with SMTP id r34mr1738749pgk.89.1556772833050; Wed, 01 May 2019 21:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556772833; cv=none; d=google.com; s=arc-20160816; b=zJyiJ4hhqDfsMnL+OsVTu0WzcAQLQ2JbsxHz9j7cLN+FDEypdx6a777m3qLYLQbWdd z+/kmfmtuWAeSTCmhQLxmaHQYhXXZf7tbUxTA0rlFVGqOguSAFMOws8QEC0w4sAqzANz yORTUEdY2uuzr1NzPVrlfV48Zu55aFZoXWpHM4PTcS9I7Qbl/4lQ/8yULwtq1LM2wtbW yyGXcLFKFx/kRb6F4uV0VYe/1TV2fXCbKYynibFjPPg0306BsIC2nRffgVt9HB3sn60A XSsM3MQi+rkdi7mG85b+mJSOikCU81fSCWiZmTCqr+021u/9r5bO4EfRMC8G42JZSVo0 Do+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=oTUoNAvTbptkwHiQB4BoNv5xEebc0qVEEYx9fowqT+s=; b=jhzVN84sBTKHarXkvhf9PFRYZxRKX+NmnFXyxim53ByduoDyHMazaphy+s8kJDmFjf SGTDSwCOlhcKBSYF+GqLz3ntVKKm5WjnJqhaKPXuNVIIjGUjdsuDjEtaED3iPt5yP3AJ snHC2s831R0mPSaTXGHx/qj0SZewgA5F9ItHpwiGv29hBPrGzy/8F8CJr0baRY0xPLPC QtLECL1wQY8A24nOSwaUdMSgaIqCd4u9uv1ZxbxaRltXNW2tt29rZJeeYSJEjjc0d8nF NCJ8TPc13SPCsVThDUpGbSC25i3+5REujENUfmTq4+yVc9FSXQ44E+9IhPDSjRwuwOQQ EXOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=oC51hi27; 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 o5si30890093pgp.44.2019.05.01.21.53.37; Wed, 01 May 2019 21:53:53 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=oC51hi27; 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 S1726191AbfEBEws (ORCPT + 99 others); Thu, 2 May 2019 00:52:48 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:36554 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbfEBEws (ORCPT ); Thu, 2 May 2019 00:52:48 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44vjYn5z2vz9v0BV; Thu, 2 May 2019 06:52:45 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=oC51hi27; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 0TUnsWMW3vXT; Thu, 2 May 2019 06:52:45 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44vjYn4rZBz9v0BC; Thu, 2 May 2019 06:52:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556772765; bh=oTUoNAvTbptkwHiQB4BoNv5xEebc0qVEEYx9fowqT+s=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=oC51hi27WAkc8iHZkPAl58pflieW+TouGLtmSDXZSe87JlN74wedySK6NhkoeGFA1 Jq+AyX73+z7yScKsRYE+TYvzCeieb6eQ15HoV7fS9NC/ot6sx+7berTcq+2fmHLuJ/ wmUYb/IjZpoGDMHaiuuZ/GwuFwGZdzX13EV1SlyU= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 79AC18B84E; Thu, 2 May 2019 06:52:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id lb_56fQc7pmk; Thu, 2 May 2019 06:52:46 +0200 (CEST) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DD09C8B74C; Thu, 2 May 2019 06:52:45 +0200 (CEST) Subject: Re: [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property To: Rasmus Villemoes , "devicetree@vger.kernel.org" , Qiang Zhao , Li Yang Cc: "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Rob Herring , Scott Wood , Mark Rutland , Rasmus Villemoes References: <20190430133615.25721-1-rasmus.villemoes@prevas.dk> <20190501092841.9026-1-rasmus.villemoes@prevas.dk> <20190501092841.9026-6-rasmus.villemoes@prevas.dk> From: Christophe Leroy Message-ID: <53c8e642-5efa-c476-92b7-a70d5598b217@c-s.fr> Date: Thu, 2 May 2019 06:52:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190501092841.9026-6-rasmus.villemoes@prevas.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 01/05/2019 à 11:29, Rasmus Villemoes a écrit : > Add driver support for the newly introduced fsl,qe-snums property. > > Conveniently, of_property_read_variable_u8_array does exactly what we > need: If the property fsl,qe-snums is found (and has an allowed size), > the array of values get copied to snums, and the return value is the > number of snums - we cannot assign directly to num_of_snums, since we > need to check whether the return value is negative. > > Signed-off-by: Rasmus Villemoes Reviewed-by: Christophe Leroy > --- > drivers/soc/fsl/qe/qe.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c > index 0fb8b59f61ad..325d689cbf5c 100644 > --- a/drivers/soc/fsl/qe/qe.c > +++ b/drivers/soc/fsl/qe/qe.c > @@ -283,7 +283,6 @@ EXPORT_SYMBOL(qe_clock_source); > */ > static void qe_snums_init(void) > { > - int i; > static const u8 snum_init_76[] = { > 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, > 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, > @@ -304,7 +303,21 @@ static void qe_snums_init(void) > 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59, > 0x68, 0x69, 0x78, 0x79, 0x80, 0x81, > }; > + struct device_node *qe; > const u8 *snum_init; > + int i; > + > + bitmap_zero(snum_state, QE_NUM_OF_SNUM); > + qe = qe_get_device_node(); > + if (qe) { > + i = of_property_read_variable_u8_array(qe, "fsl,qe-snums", > + snums, 1, QE_NUM_OF_SNUM); > + of_node_put(qe); > + if (i > 0) { > + qe_num_of_snum = i; > + return; > + } > + } > > qe_num_of_snum = qe_get_num_of_snums(); > > @@ -313,7 +326,6 @@ static void qe_snums_init(void) > else > snum_init = snum_init_46; > > - bitmap_zero(snum_state, QE_NUM_OF_SNUM); > memcpy(snums, snum_init, qe_num_of_snum); > } > >