From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92F9EC3F2D1 for ; Tue, 3 Mar 2020 17:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AF7220CC7 for ; Tue, 3 Mar 2020 17:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbgCCRgx (ORCPT ); Tue, 3 Mar 2020 12:36:53 -0500 Received: from mga17.intel.com ([192.55.52.151]:47673 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727993AbgCCRgx (ORCPT ); Tue, 3 Mar 2020 12:36:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2020 09:36:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,511,1574150400"; d="scan'208";a="229000291" Received: from jekeller-mobl1.amr.corp.intel.com (HELO [134.134.177.106]) ([134.134.177.106]) by orsmga007.jf.intel.com with ESMTP; 03 Mar 2020 09:36:47 -0800 Subject: Re: [PATCH v2 6/6] nfp: Use pci_get_dsn() To: Jakub Kicinski Cc: linux-pci@vger.kernel.org, netdev@vger.kernel.org, Bjorn Helgaas , David Miller References: <20200303022506.1792776-1-jacob.e.keller@intel.com> <20200303022506.1792776-7-jacob.e.keller@intel.com> <20200302194044.27eb9e5a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Jacob Keller Organization: Intel Corporation Message-ID: Date: Tue, 3 Mar 2020 09:36:47 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200302194044.27eb9e5a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On 3/2/2020 7:40 PM, Jakub Kicinski wrote: > On Mon, 2 Mar 2020 18:25:05 -0800 Jacob Keller wrote: >> Use the newly added pci_get_dsn() function for obtaining the 64-bit >> Device Serial Number in the nfp6000_read_serial and >> nfp_6000_get_interface functions. >> >> pci_get_dsn() reports the Device Serial number as a u64 value created by >> combining two pci_read_config_dword functions. The lower 16 bits >> represent the device interface value, and the next 48 bits represent the >> serial value. Use put_unaligned_be32 and put_unaligned_be16 to convert >> the serial value portion into a Big Endian formatted serial u8 array. >> >> Signed-off-by: Jacob Keller >> Cc: Jakub Kicinski > > Reviewed-by: Jakub Kicinski > > Thanks! > >> - pci_read_config_dword(pdev, pos + 4, ®); >> - put_unaligned_be16(reg >> 16, serial + 4); >> - pci_read_config_dword(pdev, pos + 8, ®); >> - put_unaligned_be32(reg, serial); >> + put_unaligned_be32((u32)(dsn >> 32), serial); >> + put_unaligned_be16((u16)(dsn >> 16), serial + 4); > > nit: the casts and extra brackets should be unnecessary, in case > you're respinning.. > Ah, yea because the argument will get converted properly by the function. It's a bit of a habit since we use one of the -W warnings that warns about implicit conversions that use truncation. I can remove them if I need to respin. It looks like this got picked up by one of the kbuild bots but got applied without the main PCI patch that implemented pci_get_dsn. Thanks, Jake