Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755135Ab2JPVZj (ORCPT ); Tue, 16 Oct 2012 17:25:39 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:45005 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918Ab2JPVZi (ORCPT ); Tue, 16 Oct 2012 17:25:38 -0400 Date: Tue, 16 Oct 2012 14:25:33 -0700 From: Greg KH To: Linus Walleij Cc: Roland Stigge , grant.likely@secretlab.ca, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de, jbe@pengutronix.de, plagnioj@jcrosoft.com, highguy@gmail.com, broonie@opensource.wolfsonmicro.com, daniel-gl@gmx.net, rmallon@gmail.com Subject: Re: [PATCH RFC 02/11 v4] gpio: Add sysfs support to block GPIO API Message-ID: <20121016212533.GC21041@kroah.com> References: <1350343887-7344-1-git-send-email-stigge@antcom.de> <1350343887-7344-3-git-send-email-stigge@antcom.de> <20121015235720.GA3132@kroah.com> <507D58D9.2040607@antcom.de> <20121016164326.GA4858@kroah.com> <20121016174038.GA17982@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1803 Lines: 50 On Tue, Oct 16, 2012 at 11:08:51PM +0200, Linus Walleij wrote: > On Tue, Oct 16, 2012 at 7:40 PM, Greg KH wrote: > > On Tue, Oct 16, 2012 at 07:27:15PM +0200, Linus Walleij wrote: > >> The thing is, as I've tried to explain but maybe didn't get across, > >> that these devices don't *have* a parent, and are not part of any > >> tree. > > > > You are passing in a parent device to the device_create() call, where > > did that pointer come from? > > You mean this: > > dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), > desc, ioname ? ioname : "gpio%u", gpio); Yes. > desc->chip->dev is an *optional* pointer to a parent device of > the GPIO chip (not the GPIO chip itself). It is usually NULL. Ah, I didn't realize that. Well, then they turn into "virtual" devices, which are still fine, they show up in the device tree properly, so all is ok. > >> They are parentless mock devices, created on-the-fly just to get > >> sysfs entries. > > > > That's fine, well, not the "parentless" part, but that should be trivial > > to fix, just pass in the correct pointer and you should be fine. > > Hm, yeah well, they are orphans mostly. > > >> What is needed it to get the device model right in the first > >> place. > > > > I thought it was in the device model already? > > GPIO chips are not devices. :-( Point to the device that the GPIO pins are located on. Be it the cpu, or platform, or something else. If not, making them "virtual" is fine, that's what it is there for. greg k-h -- 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/