From patchwork Mon Sep 26 08:49:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 9350311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BC476077B for ; Mon, 26 Sep 2016 08:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F118028BEB for ; Mon, 26 Sep 2016 08:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5B6828BF4; Mon, 26 Sep 2016 08:49:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1911128BEB for ; Mon, 26 Sep 2016 08:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759651AbcIZItR (ORCPT ); Mon, 26 Sep 2016 04:49:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:42178 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758253AbcIZItR (ORCPT ); Mon, 26 Sep 2016 04:49:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A3510AC9E for ; Mon, 26 Sep 2016 08:49:15 +0000 (UTC) Date: Mon, 26 Sep 2016 10:49:14 +0200 From: Jean Delvare To: linux-hwmon@vger.kernel.org Subject: [PATCH] sensors-detect: Report proper processor information on ppc Message-ID: <20160926104914.554fb354@endymion> Organization: SUSE Linux X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The format of /proc/cpuinfo on ppc differs from the x86 format. Add the missing pieces to the parsing code so that ppc processor information is reported properly. Reviewed-by: Guenter Roeck --- prog/detect/sensors-detect | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2864,7 +2864,7 @@ sub initialize_cpu_list }; next; } - if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level)\s*:\s*(.+)$/) { + if (m/^(vendor_id|cpu family|model|model name|stepping|cpuid level|cpu|revision)\s*:\s*(.+)$/) { my $k = $1; my $v = $2; $v =~ s/\s+/ /g; # Merge multiple spaces @@ -2880,7 +2880,11 @@ sub initialize_cpu_list sub print_cpu_info { my $cpu = $cpu[0]; - print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n"; + if (defined $cpu->{'model name'}) { + print "# Processor: $cpu->{'model name'} ($cpu->{'cpu family'}/$cpu->{model}/$cpu->{stepping})\n"; + } elsif (defined $cpu->{'cpu'}) { # ppc + print "# Processor: $cpu->{'cpu'}, revision $cpu->{'revision'}\n"; + } } # @i2c_adapters is a list of references to hashes, one hash per I2C/SMBus