* [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
@ 2012-10-09 22:50 Dimitris Papastamos
0 siblings, 0 replies; 6+ messages in thread
From: Dimitris Papastamos @ 2012-10-09 22:50 UTC (permalink / raw)
To: linux-kernel
This patch provides the aforementioned procfs file that lists
the default firmware paths that are used during firmware lookup.
The file contains a white space separated list of paths.
There will be another patch on top of this that adds the functionality
to modify the paths at runtime.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
drivers/base/firmware_class.c | 55 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 2153eab..22cef4d 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -27,6 +27,8 @@
#include <linux/pm.h>
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <generated/utsrelease.h>
@@ -1430,6 +1432,56 @@ err_fwp_alloc:
return -ENOMEM;
}
+static void *fw_path_seq_start(struct seq_file *seq, loff_t *pos)
+{
+ return seq_list_start_head(&fw_path_list, *pos);
+}
+
+static void *fw_path_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ return seq_list_next(v, &fw_path_list, pos);
+}
+
+static int fw_path_seq_show(struct seq_file *seq, void *v)
+{
+ const struct fw_path_rec *fwp;
+ struct list_head *l = v;
+
+ if (l == &fw_path_list)
+ return 0;
+ fwp = list_entry(v, struct fw_path_rec, list);
+ seq_puts(seq, fwp->name);
+ if (l->next != &fw_path_list)
+ seq_putc(seq, ' ');
+ else
+ seq_putc(seq, '\n');
+ return 0;
+}
+
+static void fw_path_seq_stop(struct seq_file *seq, void *v)
+{
+}
+
+static const struct seq_operations fw_path_ops = {
+ .start = fw_path_seq_start,
+ .next = fw_path_seq_next,
+ .stop = fw_path_seq_stop,
+ .show = fw_path_seq_show,
+};
+
+static int fw_path_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &fw_path_ops);
+}
+
+static const struct file_operations fw_path_seq_fops = {
+ .owner = THIS_MODULE,
+ .open = fw_path_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static void __init fw_cache_init(void)
{
spin_lock_init(&fw_cache.lock);
@@ -1465,6 +1517,8 @@ static int __init firmware_class_init(void)
return ret;
}
+ proc_create("fw_path", S_IRUGO, NULL, &fw_path_seq_fops);
+
return class_register(&firmware_class);
}
@@ -1474,6 +1528,7 @@ static void __exit firmware_class_exit(void)
unregister_syscore_ops(&fw_syscore_ops);
unregister_pm_notifier(&fw_cache.pm_notify);
#endif
+ remove_proc_entry("fw_path", NULL);
fw_free_path_list();
class_unregister(&firmware_class);
}
--
1.7.12.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
2012-10-10 10:56 [PATCH 0/2] Expose firmware paths via procfs Dimitris Papastamos
@ 2012-10-10 10:56 ` Dimitris Papastamos
2012-10-10 13:36 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Dimitris Papastamos @ 2012-10-10 10:56 UTC (permalink / raw)
To: linux-kernel; +Cc: Ming Lei, Greg Kroah-Hartman
This patch provides the aforementioned procfs file that lists
the default firmware paths that are used during firmware lookup.
The file contains a white space separated list of paths.
There will be another patch on top of this that adds the functionality
to modify the paths at runtime.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
drivers/base/firmware_class.c | 55 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 2153eab..22cef4d 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -27,6 +27,8 @@
#include <linux/pm.h>
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <generated/utsrelease.h>
@@ -1430,6 +1432,56 @@ err_fwp_alloc:
return -ENOMEM;
}
+static void *fw_path_seq_start(struct seq_file *seq, loff_t *pos)
+{
+ return seq_list_start_head(&fw_path_list, *pos);
+}
+
+static void *fw_path_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ return seq_list_next(v, &fw_path_list, pos);
+}
+
+static int fw_path_seq_show(struct seq_file *seq, void *v)
+{
+ const struct fw_path_rec *fwp;
+ struct list_head *l = v;
+
+ if (l == &fw_path_list)
+ return 0;
+ fwp = list_entry(v, struct fw_path_rec, list);
+ seq_puts(seq, fwp->name);
+ if (l->next != &fw_path_list)
+ seq_putc(seq, ' ');
+ else
+ seq_putc(seq, '\n');
+ return 0;
+}
+
+static void fw_path_seq_stop(struct seq_file *seq, void *v)
+{
+}
+
+static const struct seq_operations fw_path_ops = {
+ .start = fw_path_seq_start,
+ .next = fw_path_seq_next,
+ .stop = fw_path_seq_stop,
+ .show = fw_path_seq_show,
+};
+
+static int fw_path_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &fw_path_ops);
+}
+
+static const struct file_operations fw_path_seq_fops = {
+ .owner = THIS_MODULE,
+ .open = fw_path_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static void __init fw_cache_init(void)
{
spin_lock_init(&fw_cache.lock);
@@ -1465,6 +1517,8 @@ static int __init firmware_class_init(void)
return ret;
}
+ proc_create("fw_path", S_IRUGO, NULL, &fw_path_seq_fops);
+
return class_register(&firmware_class);
}
@@ -1474,6 +1528,7 @@ static void __exit firmware_class_exit(void)
unregister_syscore_ops(&fw_syscore_ops);
unregister_pm_notifier(&fw_cache.pm_notify);
#endif
+ remove_proc_entry("fw_path", NULL);
fw_free_path_list();
class_unregister(&firmware_class);
}
--
1.7.12.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
2012-10-10 10:56 ` [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths Dimitris Papastamos
@ 2012-10-10 13:36 ` Greg Kroah-Hartman
2012-10-10 13:40 ` Josh Boyer
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2012-10-10 13:36 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: linux-kernel, Ming Lei
On Wed, Oct 10, 2012 at 11:56:25AM +0100, Dimitris Papastamos wrote:
> This patch provides the aforementioned procfs file that lists
> the default firmware paths that are used during firmware lookup.
>
> The file contains a white space separated list of paths.
>
> There will be another patch on top of this that adds the functionality
> to modify the paths at runtime.
>
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
What about /proc/sys/kernel/firmware_path instead? Isn't that a better
place for this?
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
2012-10-10 13:36 ` Greg Kroah-Hartman
@ 2012-10-10 13:40 ` Josh Boyer
2012-10-10 13:45 ` Dimitris Papastamos
2012-10-10 14:41 ` Dimitris Papastamos
2 siblings, 0 replies; 6+ messages in thread
From: Josh Boyer @ 2012-10-10 13:40 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Dimitris Papastamos, linux-kernel, Ming Lei
On Wed, Oct 10, 2012 at 9:36 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Wed, Oct 10, 2012 at 11:56:25AM +0100, Dimitris Papastamos wrote:
>> This patch provides the aforementioned procfs file that lists
>> the default firmware paths that are used during firmware lookup.
>>
>> The file contains a white space separated list of paths.
>>
>> There will be another patch on top of this that adds the functionality
>> to modify the paths at runtime.
>>
>> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
>
> What about /proc/sys/kernel/firmware_path instead? Isn't that a better
> place for this?
Without painting the bikeshed too many colors, I was wondering if /proc
was the right place for this at all. Perhaps /sys/kernel/firmware_path
or /sys/firmware/firmware_path?
josh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
2012-10-10 13:36 ` Greg Kroah-Hartman
2012-10-10 13:40 ` Josh Boyer
@ 2012-10-10 13:45 ` Dimitris Papastamos
2012-10-10 14:41 ` Dimitris Papastamos
2 siblings, 0 replies; 6+ messages in thread
From: Dimitris Papastamos @ 2012-10-10 13:45 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Ming Lei
On Wed, Oct 10, 2012 at 10:36:55PM +0900, Greg Kroah-Hartman wrote:
> On Wed, Oct 10, 2012 at 11:56:25AM +0100, Dimitris Papastamos wrote:
> > This patch provides the aforementioned procfs file that lists
> > the default firmware paths that are used during firmware lookup.
> >
> > The file contains a white space separated list of paths.
> >
> > There will be another patch on top of this that adds the functionality
> > to modify the paths at runtime.
> >
> > Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
>
> What about /proc/sys/kernel/firmware_path instead? Isn't that a better
> place for this?
>
> greg k-h
Yes that makes more sense to me.
Thanks,
Dimitris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths
2012-10-10 13:36 ` Greg Kroah-Hartman
2012-10-10 13:40 ` Josh Boyer
2012-10-10 13:45 ` Dimitris Papastamos
@ 2012-10-10 14:41 ` Dimitris Papastamos
2 siblings, 0 replies; 6+ messages in thread
From: Dimitris Papastamos @ 2012-10-10 14:41 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Ming Lei
On Wed, Oct 10, 2012 at 10:36:55PM +0900, Greg Kroah-Hartman wrote:
> On Wed, Oct 10, 2012 at 11:56:25AM +0100, Dimitris Papastamos wrote:
> > This patch provides the aforementioned procfs file that lists
> > the default firmware paths that are used during firmware lookup.
> >
> > The file contains a white space separated list of paths.
> >
> > There will be another patch on top of this that adds the functionality
> > to modify the paths at runtime.
> >
> > Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
>
> What about /proc/sys/kernel/firmware_path instead? Isn't that a better
> place for this?
>
> greg k-h
Btw, a primitive set of patches along with write support are stashed
at http://opensource.wolfsonmicro.com/~dp/patches/firmware/ - will clean
these up and place the file at /proc/sys/kernel/firmware_path and
will send out a new version of the patch set.
Thanks,
Dimitris
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-10-10 14:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09 22:50 [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths Dimitris Papastamos
-- strict thread matches above, loose matches on Subject: below --
2012-10-10 10:56 [PATCH 0/2] Expose firmware paths via procfs Dimitris Papastamos
2012-10-10 10:56 ` [PATCH 2/2] firmware: Add /proc/fw_path entry to list the firmware paths Dimitris Papastamos
2012-10-10 13:36 ` Greg Kroah-Hartman
2012-10-10 13:40 ` Josh Boyer
2012-10-10 13:45 ` Dimitris Papastamos
2012-10-10 14:41 ` Dimitris Papastamos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox