From patchwork Thu Nov 13 15:23:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 5298791 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F270C11AC for ; Thu, 13 Nov 2014 15:23:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4807F2020F for ; Thu, 13 Nov 2014 15:23:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B14B9201C8 for ; Thu, 13 Nov 2014 15:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933309AbaKMPXe (ORCPT ); Thu, 13 Nov 2014 10:23:34 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40014 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933132AbaKMPXe (ORCPT ); Thu, 13 Nov 2014 10:23:34 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4A037ACA0; Thu, 13 Nov 2014 15:23:33 +0000 (UTC) From: Thomas Renninger To: Martin Mares Cc: linux-pci@vger.kernel.org Subject: Re: [PATCH] lspci: Show device name as exported by BIOS (sysfs label attribute) (V2) Date: Thu, 13 Nov 2014 16:23:33 +0100 Message-ID: <15082489.1nYBiW1zHH@skinner> User-Agent: KMail/4.14.2 (Linux/3.16.6-2-desktop; KDE/4.14.2; x86_64; ; ) In-Reply-To: References: <1390856419-35985-1-git-send-email-trenn@suse.de> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, and sorry for the late reply. On Saturday, November 01, 2014 05:16:08 PM Martin Mares wrote: > > Thanks, applied. (With minor changes, like using OBJBUFSIZE instead of > > a hard-coded constant 1024.) > > ... I realized that your way of reading the label attribute was > completely different from reading of most other device attributes. > > I changed it, now it read only on request by pci_fill_info() with the > PCI_FILL_LABEL flag. > > Could you please check that the version in pciutils.git still works > for you? I tried with latest 3.3.0 version and things work as expected: lspci -v |grep DeviceName: DeviceName: USB HS EHCI Controller #2 #3 DeviceName: USB HS EHCI Controller #1 DeviceName: SATA Controller #1 DeviceName: Onboard LAN #1 DeviceName: Onboard LAN #2 DeviceName: Onboard Video (PILOT-3) Thanks a lot! Hm, while using the latest 3.3.0 tarball with our pciutils dist package I realized that this diff does not perfectly patch anymore. Unfortunately without author, looks like a gcc guy added it. I paste it in the end You may want to incorporate (a shortened version?) it if appropriate. Be careful, needs patch -p0 Thomas Dear kernel developers. we plead to you, please use documented,optimized userspace interfaces, thanks ! --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- lib/sysdep.h.orig +++ lib/sysdep.h @@ -18,71 +18,10 @@ typedef u8 byte; typedef u16 word; -#ifdef PCI_OS_WINDOWS -#define strcasecmp strcmpi -#endif - -#ifdef PCI_HAVE_LINUX_BYTEORDER_H - -#include -#define cpu_to_le16 __cpu_to_le16 -#define cpu_to_le32 __cpu_to_le32 -#define le16_to_cpu __le16_to_cpu -#define le32_to_cpu __le32_to_cpu - -#else - -#ifdef PCI_OS_LINUX #include -#define BYTE_ORDER __BYTE_ORDER -#define BIG_ENDIAN __BIG_ENDIAN -#endif - -#ifdef PCI_OS_SUNOS -#include -#define BIG_ENDIAN 4321 -#ifdef _LITTLE_ENDIAN -#define BYTE_ORDER 1234 -#else -#define BYTE_ORDER 4321 -#endif -#endif - -#ifdef PCI_OS_WINDOWS -#ifdef __MINGW32__ - #include -#else - #include - #define BIG_ENDIAN 4321 - #define LITTLE_ENDIAN 1234 - #define BYTE_ORDER LITTLE_ENDIAN - #define snprintf _snprintf -#endif -#endif - -#if BYTE_ORDER == BIG_ENDIAN -#define cpu_to_le16 swab16 -#define cpu_to_le32 swab32 -#define le16_to_cpu swab16 -#define le32_to_cpu swab32 - -static inline word swab16(word w) -{ - return (w << 8) | ((w >> 8) & 0xff); -} -static inline u32 swab32(u32 w) -{ - return ((w & 0xff000000) >> 24) | - ((w & 0x00ff0000) >> 8) | - ((w & 0x0000ff00) << 8) | - ((w & 0x000000ff) << 24); -} -#else -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#endif +#define cpu_to_le16 htole16 +#define cpu_to_le32 htole32 +#define le16_to_cpu le16toh +#define le32_to_cpu le32toh -#endif