From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <4E9C5777.5040904@cam.ac.uk> Date: Mon, 17 Oct 2011 17:27:35 +0100 From: Jonathan Cameron MIME-Version: 1.0 To: Jonathan Cameron CC: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, guenter.roeck@ericsson.com, khali@linux-fr.org, dmitry.torokhov@gmail.com, broonie@opensource.wolfsonmicro.com, gregkh@suse.de, alan@lxorguk.ukuu.org.uk, arnd@arndb.de Subject: Re: [PATCH 1/6] IIO: Core sysfs only support. References: <1318857381-13787-1-git-send-email-jic23@cam.ac.uk> <1318857381-13787-2-git-send-email-jic23@cam.ac.uk> In-Reply-To: <1318857381-13787-2-git-send-email-jic23@cam.ac.uk> Content-Type: text/plain; charset=ISO-8859-1 List-ID: On 10/17/11 14:16, Jonathan Cameron wrote: > Add support for simple sysfs only interfaces. > > Bulk of patch is concerned with taking struct iio_chan_spec > arrays and generating all the relevant interfaces from them. Sorry all, one little rather debilitating buglet in here. Means no attrs actually get registered. ... > +struct iio_dev *iio_device_allocate(int sizeof_priv) > +{ > + struct iio_dev *dev; > + size_t alloc_size; > + > + alloc_size = sizeof(struct iio_dev); > + if (sizeof_priv) { > + alloc_size = ALIGN(alloc_size, IIO_ALIGN); > + alloc_size += sizeof_priv; > + } > + /* ensure cacheline alignment of whole construct */ > + alloc_size += IIO_ALIGN - 1; > + > + dev = kzalloc(alloc_size, GFP_KERNEL); > + > + if (dev) { Following line was missing for some reason. dev->dev.groups = dev->groups; > + dev->dev.type = &iio_dev_type; > + dev->dev.bus = &iio_bus_type; > + device_initialize(&dev->dev); > + dev_set_drvdata(&dev->dev, (void *)dev); > + mutex_init(&dev->mlock); > + } > + > + return dev; > +} > +EXPORT_SYMBOL_GPL(iio_device_allocate); ..