Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753642AbaJMKcc (ORCPT ); Mon, 13 Oct 2014 06:32:32 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:44476 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753614AbaJMKca (ORCPT ); Mon, 13 Oct 2014 06:32:30 -0400 MIME-Version: 1.0 In-Reply-To: <20141012170637.GA12591@roeck-us.net> References: <1412885235-14026-1-git-send-email-octavian.purdila@intel.com> <1412885235-14026-4-git-send-email-octavian.purdila@intel.com> <20141012170637.GA12591@roeck-us.net> Date: Mon, 13 Oct 2014 13:32:28 +0300 Message-ID: Subject: Re: [RFC PATCH 3/3] i2c: show and change bus frequency via sysfs From: Octavian Purdila To: Guenter Roeck Cc: Mark Roszko , linux-i2c , linux-api@vger.kernel.org, lkml , Johan Hovold , Wolfram Sang Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 12, 2014 at 8:06 PM, Guenter Roeck wrote: > On Sun, Oct 12, 2014 at 12:32:56PM +0300, Octavian Purdila wrote: >> On Sat, Oct 11, 2014 at 11:14 PM, Mark Roszko wrote: >> >> > This seems limiting to arches with peripherals that can support a range of >> > frequencies rather than fixed numbers. >> > Also it creates some portability quirkiness between platforms when all the >> > i2c bus drivers have different supported freq lists and you have to match >> > exactly the right frequency. I.e. one guy does 60khz but another only has >> > 80khz. >> >> Sorry, I don't understand your points here. If this limitations exists >> they are not introduced by this patch. This patch just exposes the >> frequency so that it can be read or changed in userspace. >> >> > Another issue is in systems where you have i2c devices on the same bus as >> > the sysfs user space driver. User space could set a bus frequency that >> > prevents operation with a system i2c device. >> >> Changing the frequency is limited to root. Also, bus drivers do not >> have to implement set_freq if it is thought not to be safe. >> >> On a different not, I have noticed that a fixed set of frequencies >> might not be the best API, since multiple drivers rather support a >> rather large set of frequencies in a range. A better API might be to >> expose a min-max range and let the bus driver adjust the requested >> frequency. I will follow up with a second version that does that. > > As two separate sysfs attributes, maybe ? sysfs is supposed to provide > one value per attribute. > Yes, I was thinking of using three attributes: bus_frequency, bus_min_frequency and bus_max_frequency. > For the patch itself, I would find it better if you used is_visible to > determine if the new attributes should be visible (and/or writable) instead > of returning -EOPNOTSUPP. > OK, that sounds better. I will switch to that model in v2. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/