From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754233AbcEYLUL (ORCPT ); Wed, 25 May 2016 07:20:11 -0400 Received: from 37-46-169-123.customers.ownit.se ([37.46.169.123]:60831 "EHLO zoo.weinigel.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751721AbcEYLUI (ORCPT ); Wed, 25 May 2016 07:20:08 -0400 Subject: Re: [PATCH] devicetree - document using aliases to set spi bus number. To: Mark Brown , Mark Rutland References: <1464107960-10775-1-git-send-email-christer@weinigel.se> <20160524174140.GE11605@leverpostej> <5744BC76.9090403@gmail.com> <20160525092034.GE1337@leverpostej> <20160525103810.GU8206@sirena.org.uk> Cc: Frank Rowand , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org From: Christer Weinigel X-Enigmail-Draft-Status: N1110 Message-ID: <57458A64.2090901@weinigel.se> Date: Wed, 25 May 2016 13:20:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160525103810.GU8206@sirena.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/25/2016 12:38 PM, Mark Brown wrote: > On Wed, May 25, 2016 at 10:20:34AM +0100, Mark Rutland wrote: >> On Tue, May 24, 2016 at 01:41:26PM -0700, Frank Rowand wrote: > >>> The code and behavior is in the Linux kernel. It should be >>> visible in the documentation instead of being a big mystery of >>> how it works. > >> As above, I don't entirely agree. Mindlessly documenting existing >> Linux behaviour can have the unfortuante effect of moving people >> towards the wrong tool for the job. > > Yes, this is exactly my concern - the articulated use case (which > didn't suprise me at all) is for using spidev which is itself not > just Linux specific but this particular version of Linux right now > specific. There are lots of things that happen to work but are in > fact terrible ideas that leave messes for our future selves. We > need to distinguish between things that are real, meaningful system > descriptions and things that are implementation details resulting > from the rush to force everyone on to DT. Oh, for *beep* *beep* sake. It used to be very easy to use SPI devices on Linux with stable device names. Add a platform device entry and set bus_num. Add spidev entries specifying the chip select, mode, speed and other specifics for the devices on the bus. Then just use /dev/spi$bus_num.$chip_select to talk to them. Very simple to use and understand. Doing the same with devicetree ought to be just as simple, and since Grant added that patch it actually is. The behaviour is already in the Linux kernel. Nobody is going to rip out the of_alias_get_id usage from the spi driver sice that will break existing userspace. Nobody is going to rip out the spidev framework from the Linux kernel. The aliases mechanism which is specifically intended to provide easy-to use names for userspace. From "A Symphony of Flavours: Using the device tree to describe embedded hardware" by Grant Likely and Josh Boyer: In order to ease device lookup in client operating systems, it is often desirable to define an aliases node. This allows one to provide a shorthand method for identifying a device without having to specify the full path on lookup. What is so horrible about documenting the actual behaviour of the Linux kernel? How is documenting that serial0 = /amba@0/blah@blah" which is ok, so markedly different from documenting spi0 = "/amba@0/blah/blah"? Does everything have to be so damn difficult? Ignore the patch if you want to, I give up. I just hope that someone else that needs to do the same thing will find my patch with this (ought to be) trivial documentation. /Christer (tired of bikeshedding)