mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: iio-linux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de,
	Jonathan Cameron <jic23@cam.ac.uk>
Subject: [PATCH 06/19] staging:iio: Move event attributes into the event[n] device in sysfs
Date: Mon, 26 Apr 2010 20:31:08 +0100	[thread overview]
Message-ID: <1272310281-7418-7-git-send-email-jic23@cam.ac.uk> (raw)
In-Reply-To: <1272310281-7418-6-git-send-email-jic23@cam.ac.uk>

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 drivers/staging/iio/industrialio-core.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index c19a080..3df23be 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -676,16 +676,14 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
 					 dev_info->event_interfaces[i].id);
 			goto error_free_setup_ev_ints;
 		}
-	}
 
-	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
-		snprintf(dev_info->event_interfaces[i]._attrname, 20,
-			"event_line%d_sources", i);
-		dev_info->event_attrs[i].name
-			= (const char *)
-			(dev_info->event_interfaces[i]._attrname);
-		ret = sysfs_create_group(&dev_info->dev.kobj,
-					 &dev_info->event_attrs[i]);
+		dev_set_drvdata(&dev_info->event_interfaces[i].dev,
+				(void *)dev_info);
+		ret = sysfs_create_group(&dev_info
+					->event_interfaces[i]
+					.dev.kobj,
+					&dev_info->event_attrs[i]);
+
 		if (ret) {
 			dev_err(&dev_info->dev,
 				"Failed to register sysfs for event attrs");
@@ -707,13 +705,13 @@ error_unregister_config_attrs:
 	i = dev_info->num_interrupt_lines - 1;
 error_remove_sysfs_interfaces:
 	for (j = 0; j < i; j++)
-		sysfs_remove_group(&dev_info->dev.kobj,
+		sysfs_remove_group(&dev_info
+				   ->event_interfaces[j].dev.kobj,
 				   &dev_info->event_attrs[j]);
-	i = dev_info->num_interrupt_lines - 1;
 error_free_setup_ev_ints:
 	for (j = 0; j < i; j++) {
 		iio_free_idr_val(&iio_event_idr,
-				 dev_info->event_interfaces[i].id);
+				 dev_info->event_interfaces[j].id);
 		iio_free_ev_int(&dev_info->event_interfaces[j]);
 	}
 	kfree(dev_info->interrupts);
@@ -731,7 +729,8 @@ static void iio_device_unregister_eventset(struct iio_dev *dev_info)
 	if (dev_info->num_interrupt_lines == 0)
 		return;
 	for (i = 0; i < dev_info->num_interrupt_lines; i++)
-		sysfs_remove_group(&dev_info->dev.kobj,
+		sysfs_remove_group(&dev_info
+				   ->event_interfaces[i].dev.kobj,
 				   &dev_info->event_attrs[i]);
 
 	for (i = 0; i < dev_info->num_interrupt_lines; i++) {
-- 
1.6.4.4


  reply	other threads:[~2010-04-26 19:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 19:31 [PATCH 00/19 V2] staging:iio: ABi changes round 1 Jonathan Cameron
2010-04-26 19:31 ` [PATCH 01/19] staging:iio: Add new in_raw definitions for adc channels Jonathan Cameron
2010-04-26 19:31   ` [PATCH 02/19] staging:iio: Add new attrs for sampling frequency available and temp_raw Jonathan Cameron
2010-04-26 19:31     ` [PATCH 03/19] iio:staging:accelerometers move towards the new abi Jonathan Cameron
2010-04-26 19:31       ` [PATCH 04/19] staging:iio: Support functions for scan mask matching Jonathan Cameron
2010-04-26 19:31         ` [PATCH 05/19] staging: iio: Move from class to bus Jonathan Cameron
2010-04-26 19:31           ` Jonathan Cameron [this message]
2010-04-26 19:31             ` [PATCH 07/19] staging:iio: Clean out unused IIO_SCAN_EL and add IIO_SCAN_NAMED_EL_C Jonathan Cameron
2010-04-26 19:31               ` [PATCH 08/19] staging:iio:max1363 move to new abi Jonathan Cameron
2010-04-26 19:31                 ` [PATCH 09/19] staging:iio: Documentation, update iio_utils.h for the move to a bus Jonathan Cameron
2010-04-26 19:31                   ` [PATCH 10/19] staging:iio: ABI documentation (partial) Jonathan Cameron
2010-04-26 19:31                     ` [PATCH 11/19] staging:iio: Directory name changes to match new ABI Jonathan Cameron
2010-04-26 19:31                       ` [PATCH 12/19] staging:iio:tsl2563: change lux to illuminanc0_input to match new abi Jonathan Cameron
2010-04-26 19:31                         ` [PATCH 13/19] staging:iio: Remove naming via IDR's where no longer necessary under " Jonathan Cameron
2010-04-26 19:31                           ` [PATCH 14/19] staging:iio:max1363 add support for max11606-max11617 Jonathan Cameron
2010-04-26 19:31                             ` [PATCH 15/19] staging:iio:max1363 add support for 8 bit equivalent devices, max1036-9, max11600-5 Jonathan Cameron
2010-04-26 19:31                               ` [PATCH 16/19] Staging: IIO: Fix uses of spinlocks prior to init in ring implementations Jonathan Cameron
2010-04-26 19:31                                 ` [PATCH 17/19] staging:iio:ring_sw: Fix incorrect test on successful read of last value, causes infinite loop Jonathan Cameron
2010-04-26 19:31                                   ` [PATCH 18/19] staging:iio:tsl2563 add a name attribute under the iio Jonathan Cameron
2010-04-26 19:31                                     ` [PATCH 19/19] staging:iio:Documentation: Rewrite example for new abi Jonathan Cameron
2010-04-26 20:10 ` [PATCH 00/19 V2] staging:iio: ABi changes round 1 Jonathan Cameron
2010-04-26 21:30   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1272310281-7418-7-git-send-email-jic23@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=gregkh@suse.de \
    --cc=iio-linux@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®