File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ static struct iio_buffer_access_funcs iio_cb_access = {
2525 .store_to = & iio_buffer_cb_store_to ,
2626};
2727
28- struct iio_cb_buffer * iio_channel_get_all_cb (const char * name ,
28+ struct iio_cb_buffer * iio_channel_get_all_cb (struct device * dev ,
2929 int (* cb )(u8 * data ,
3030 void * private ),
3131 void * private )
@@ -46,7 +46,7 @@ struct iio_cb_buffer *iio_channel_get_all_cb(const char *name,
4646 cb_buff -> buffer .access = & iio_cb_access ;
4747 INIT_LIST_HEAD (& cb_buff -> buffer .demux_list );
4848
49- cb_buff -> channels = iio_channel_get_all (name );
49+ cb_buff -> channels = iio_channel_get_all (dev );
5050 if (IS_ERR (cb_buff -> channels )) {
5151 ret = PTR_ERR (cb_buff -> channels );
5252 goto error_free_cb_buff ;
Original file line number Diff line number Diff line change @@ -167,16 +167,18 @@ void iio_channel_release(struct iio_channel *channel)
167167}
168168EXPORT_SYMBOL_GPL (iio_channel_release );
169169
170- struct iio_channel * iio_channel_get_all (const char * name )
170+ struct iio_channel * iio_channel_get_all (struct device * dev )
171171{
172+ const char * name ;
172173 struct iio_channel * chans ;
173174 struct iio_map_internal * c = NULL ;
174175 int nummaps = 0 ;
175176 int mapind = 0 ;
176177 int i , ret ;
177178
178- if (name == NULL )
179+ if (dev == NULL )
179180 return ERR_PTR (- EINVAL );
181+ name = dev_name (dev );
180182
181183 mutex_lock (& iio_map_list_lock );
182184 /* first count the matching maps */
Original file line number Diff line number Diff line change @@ -71,14 +71,17 @@ static int iio_hwmon_probe(struct platform_device *pdev)
7171 int ret , i ;
7272 int in_i = 1 , temp_i = 1 , curr_i = 1 ;
7373 enum iio_chan_type type ;
74+ struct iio_channel * channels ;
75+
76+ channels = iio_channel_get_all (dev );
77+ if (IS_ERR (channels ))
78+ return PTR_ERR (channels );
7479
7580 st = devm_kzalloc (dev , sizeof (* st ), GFP_KERNEL );
7681 if (st == NULL )
7782 return - ENOMEM ;
7883
79- st -> channels = iio_channel_get_all (dev_name (dev ));
80- if (IS_ERR (st -> channels ))
81- return PTR_ERR (st -> channels );
84+ st -> channels = channels ;
8285
8386 /* count how many attributes we have */
8487 while (st -> channels [st -> num_channels ].indio_dev )
Original file line number Diff line number Diff line change 1515
1616struct iio_dev ;
1717struct iio_chan_spec ;
18+ struct device ;
1819
1920/**
2021 * struct iio_channel - everything needed for a consumer to use a channel
@@ -48,14 +49,14 @@ void iio_channel_release(struct iio_channel *chan);
4849
4950/**
5051 * iio_channel_get_all() - get all channels associated with a client
51- * @name : name of consumer device.
52+ * @dev : Pointer to consumer device.
5253 *
5354 * Returns an array of iio_channel structures terminated with one with
5455 * null iio_dev pointer.
5556 * This function is used by fairly generic consumers to get all the
5657 * channels registered as having this consumer.
5758 */
58- struct iio_channel * iio_channel_get_all (const char * name );
59+ struct iio_channel * iio_channel_get_all (struct device * dev );
5960
6061/**
6162 * iio_channel_release_all() - reverse iio_channel_get_all
@@ -66,15 +67,15 @@ void iio_channel_release_all(struct iio_channel *chan);
6667struct iio_cb_buffer ;
6768/**
6869 * iio_channel_get_all_cb() - register callback for triggered capture
69- * @name : Name of client device.
70+ * @dev : Pointer to client device.
7071 * @cb: Callback function.
7172 * @private: Private data passed to callback.
7273 *
7374 * NB right now we have no ability to mux data from multiple devices.
7475 * So if the channels requested come from different devices this will
7576 * fail.
7677 */
77- struct iio_cb_buffer * iio_channel_get_all_cb (const char * name ,
78+ struct iio_cb_buffer * iio_channel_get_all_cb (struct device * dev ,
7879 int (* cb )(u8 * data ,
7980 void * private ),
8081 void * private );
You can’t perform that action at this time.
0 commit comments