From patchwork Wed Feb 24 14:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bamvor Zhang Jian X-Patchwork-Id: 62796 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2441754lbl; Wed, 24 Feb 2016 06:35:59 -0800 (PST) X-Received: by 10.98.11.134 with SMTP id 6mr55854247pfl.109.1456324559081; Wed, 24 Feb 2016 06:35:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si5310020pac.165.2016.02.24.06.35.58; Wed, 24 Feb 2016 06:35:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752988AbcBXOf6 (ORCPT + 4 others); Wed, 24 Feb 2016 09:35:58 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:36494 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbcBXOf5 (ORCPT ); Wed, 24 Feb 2016 09:35:57 -0500 Received: by mail-io0-f170.google.com with SMTP id l127so42470630iof.3 for ; Wed, 24 Feb 2016 06:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=mQ+Ka464mF/hYWOz00Fu/56a4JhIyCsxcg10AigbrUA=; b=KglQR/2XUq4pLM2Q8TiwCyrn4tBxGyjadoFbNzosCkxs35Boo2iVH2dyTsxFieCpeX 1bjhob0uZcQLV8ECHaAny+OjgTAxH9iTgciP9e6YRnQP4aplrgTgQw97H+U7xNHQtoMs lOGcRchR4BMBa6it2LMcznz54qVsm3EEWuE3U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=mQ+Ka464mF/hYWOz00Fu/56a4JhIyCsxcg10AigbrUA=; b=ZcSF37dibRF4i4K/LsfVqOOYhVEqxFbOZ4AqH1ZCph132aBsuo+eHzuI6L4xzZspcc jNEat5BlfIMAbtpMFm7Wc1S7YBbR8yxFbCM/aDk+w1Zg7VbGU5JC3V7VepsGYW/EIfcx oHZKUbrvs8OcMN1Wa65MAXffcxDMXbQpdshmMwSyPCG9VMupOMJZcf+RcEEx+ESFhyGV gOyFecZp/wRCcpnm64QS1GmUMnVEety3WPmQnhNe0nbbg1YQrkt/31t32UbnOAJ3dbv1 g+pUFYQ7kss2Y6kFlpo32kYDig1M1tcPFYrj7zHkiStmTi8Gij2V2+GcDWoFAZBZccrG h26g== X-Gm-Message-State: AG10YOSMlxoMxTqbpTy2FAPYn+xX5DtXXaPiIJGk56+192H4z0zuscMiCLCRbSqH3wpdOSF1W4ZhaahCgeFfa5sP MIME-Version: 1.0 X-Received: by 10.107.131.155 with SMTP id n27mr39797345ioi.132.1456324557363; Wed, 24 Feb 2016 06:35:57 -0800 (PST) Received: by 10.36.203.5 with HTTP; Wed, 24 Feb 2016 06:35:57 -0800 (PST) Date: Wed, 24 Feb 2016 22:35:57 +0800 Message-ID: Subject: [RFD] does abi of sysfs of gpio change? From: Bamvor Zhang Jian To: linux-gpio@vger.kernel.org, Linus Walleij Cc: Grant Likely , Markus Pargmann , Johan Hovold , Michael Welling , Alexandre Courbot , Bamvor Zhang Jian Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Hi, guys I am working on writing a gpio mockup driver(for test the gpio framework). I found that in the lastest for-next branch of linux-gpio, the path of gpiochip in device directory is changed from `/sys/devices/platform/gpio-mockup/gpio/gpiochip*` to `/sys/devices/platform/gpio-mockup/gpiochip*/gpio`. And secondly, the name of gpiochip in the devices directory is changed from gpiochipBASE to gpiochipSEQ, e.g. there are two gpiochip([0,31],[32,63]) in my device. It changed from `/sys/devices/platform/gpio-mockup/gpio/gpiochip0` `/sys/devices/platform/gpio-mockup/gpio/gpiochip32` to `/sys/devices/platform/gpio-mockup/gpiochip0/gpio` `/sys/devices/platform/gpio-mockup/gpiochip1/gpio` IIUC, this change may break the script which depend on it. Is it intended to do it? And it could be fix by reverting one line from commit 5031fbdf5365 ("gpio: move sysfs mock device to the gpio_device"). Regards Bamvor >From be7699ddea0fd0e2b0712cc8f50318595cad553c Mon Sep 17 00:00:00 2001 From: Bamvor Jian Zhang Date: Wed, 24 Feb 2016 22:17:19 +0800 Subject: [PATCH] fix abi changes of sysfs Signed-off-by: Bamvor Jian Zhang --- drivers/gpio/gpiolib-sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index c563094..db39464 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -721,6 +721,7 @@ EXPORT_SYMBOL_GPL(gpiod_unexport); int gpiochip_sysfs_register(struct gpio_device *gdev) { struct device *dev; + struct device *parent; struct gpio_chip *chip = gdev->chip; /* @@ -733,7 +734,12 @@ int gpiochip_sysfs_register(struct gpio_device *gdev) return 0; /* use chip->base for the ID; it's already known to be unique */ - dev = device_create_with_groups(&gpio_class, &gdev->dev, + if (chip->parent) + parent = chip->parent; + else + parent = &gdev->dev; + + dev = device_create_with_groups(&gpio_class, parent, MKDEV(0, 0), chip, gpiochip_groups, "gpiochip%d", chip->base);