All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 2/2] sensors-detect: Fix parent device discovery
Date: Mon, 22 Oct 2012 13:55:45 +0000	[thread overview]
Message-ID: <20121022135545.GC7375@roeck-us.net> (raw)
In-Reply-To: <20121022141657.147db99d@endymion.delvare>

On Mon, Oct 22, 2012 at 02:16:57PM +0200, Jean Delvare wrote:
> Take multiplexers into account when looking up the parent device of
> each I2C adapter. We don't bother with old kernels as they didn't have
> support for multiplexers anyway.
> ---
>  prog/detect/sensors-detect |   13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> --- lm-sensors.orig/prog/detect/sensors-detect	2012-10-06 13:21:05.000000000 +0200
> +++ lm-sensors/prog/detect/sensors-detect	2012-10-06 14:39:58.981616135 +0200
> @@ -2,7 +2,7 @@
>  #
>  #    sensors-detect - Detect hardware monitoring chips
>  #    Copyright (C) 1998 - 2002  Frodo Looijaard <frodol@dds.nl>
> -#    Copyright (C) 2004 - 2011  Jean Delvare <khali@linux-fr.org>
> +#    Copyright (C) 2004 - 2012  Jean Delvare <khali@linux-fr.org>
>  #
>  #    This program is free software; you can redistribute it and/or modify
>  #    it under the terms of the GNU General Public License as published by
> @@ -2696,14 +2696,15 @@ sub initialize_i2c_adapters_list
>  			} elsif ($link =~ m/^(.*)\/i2c-$nr$/) {
>  				$entry->{path} = "${base_dir}/i2c-$nr/device";
>  				$entry->{parent} = "${base_dir}/i2c-$nr/$1";
> -			} else {
> -				$entry->{path} = "${base_dir}/i2c-$nr";
> -				$entry->{parent} = "$entry->{path}/device";
>  			}
> -		} else {
> +		}
> +
> +		# This works for all recent kernels (with or without
> +		# CONFIG_I2C_COMPAT)
> +		if (!defined $entry->{path}) {
>  			my $link = readlink("${base_dir}/i2c-$nr");
> -			$link =~ s/\/i2c-$nr$//;
>  			$entry->{path} = "${base_dir}/i2c-$nr";
> +			$link =~ s/(\/i2c-[0-9]+)+$//;	# Handle multiplexers too
>  			$entry->{parent} = "${base_dir}/$link";
>  		}
Acked-by: Guenter Roeck <linux@roeck-us.net>

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

      reply	other threads:[~2012-10-22 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 12:16 [lm-sensors] [PATCH 2/2] sensors-detect: Fix parent device discovery Jean Delvare
2012-10-22 13:55 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121022135545.GC7375@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.