[PATCH 1/3] printk: Introduce per-console loglevel setting

2017-09-28 Thread Calvin Owens
Not all consoles are created equal: depending on the actual hardware,
the latency of a printk() call can vary dramatically. The worst examples
are serial consoles, where it can spin for tens of milliseconds banging
the UART to emit a message, which can cause application-level problems
when the kernel spews onto the console.

At Facebook we use netconsole to monitor our fleet, but we still have
serial consoles attached on each host for live debugging, and the latter
has caused problems. An obvious solution is to disable the kernel
console output to ttyS0, but this makes live debugging frustrating,
since crashes become silent and opaque to the ttyS0 user. Enabling it on
the fly when needed isn't feasible, since boxes you need to debug via
serial are likely to be borked in ways that make this impossible.

That puts us between a rock and a hard place: we'd love to set
kernel.printk to KERN_INFO and get all the logs. But while netconsole is
fast enough to permit that without perturbing userspace, ttyS0 is not,
and we're forced to limit console logging to KERN_WARNING and higher.

This patch introduces a new per-console loglevel setting, and changes
console_unlock() to use max(global_level, per_console_level) when
deciding whether or not to emit a given log message.

This lets us have our cake and eat it too: instead of being forced to
limit all consoles verbosity based on the speed of the slowest one, we
can "promote" the faster console while still using a conservative system
loglevel setting to avoid disturbing applications.

Cc: Petr Mladek 
Cc: Steven Rostedt 
Cc: Sergey Senozhatsky 
Signed-off-by: Calvin Owens 
---
(V1: https://lkml.org/lkml/2017/4/4/783)

Changes in V2:
* Honor the ignore_loglevel setting in all cases
* Change semantics to use max(global, console) as the loglevel
  for a console, instead of the previous patch where we treated
  the per-console one as a filter downstream of the global one.

 include/linux/console.h |  1 +
 kernel/printk/printk.c  | 38 +++---
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/include/linux/console.h b/include/linux/console.h
index b8920a0..a5b5d79 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -147,6 +147,7 @@ struct console {
int cflag;
void*data;
struct   console *next;
+   int level;
 };
 
 /*
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 512f7c2..3f1675e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1141,9 +1141,14 @@ module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(ignore_loglevel,
 "ignore loglevel setting (prints all kernel messages to the 
console)");
 
-static bool suppress_message_printing(int level)
+static int effective_loglevel(struct console *con)
 {
-   return (level >= console_loglevel && !ignore_loglevel);
+   return max(console_loglevel, con ? con->level : LOGLEVEL_EMERG);
+}
+
+static bool suppress_message_printing(int level, struct console *con)
+{
+   return (level >= effective_loglevel(con) && !ignore_loglevel);
 }
 
 #ifdef CONFIG_BOOT_PRINTK_DELAY
@@ -1175,7 +1180,7 @@ static void boot_delay_msec(int level)
unsigned long timeout;
 
if ((boot_delay == 0 || system_state >= SYSTEM_RUNNING)
-   || suppress_message_printing(level)) {
+   || suppress_message_printing(level, NULL)) {
return;
}
 
@@ -1549,7 +1554,7 @@ SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, 
int, len)
  * The console_lock must be held.
  */
 static void call_console_drivers(const char *ext_text, size_t ext_len,
-const char *text, size_t len)
+const char *text, size_t len, int level)
 {
struct console *con;
 
@@ -1568,6 +1573,8 @@ static void call_console_drivers(const char *ext_text, 
size_t ext_len,
if (!cpu_online(smp_processor_id()) &&
!(con->flags & CON_ANYTIME))
continue;
+   if (suppress_message_printing(level, con))
+   continue;
if (con->flags & CON_EXTENDED)
con->write(con, ext_text, ext_len);
else
@@ -1856,10 +1863,9 @@ static ssize_t msg_print_ext_body(char *buf, size_t size,
  char *dict, size_t dict_len,
  char *text, size_t text_len) { return 0; }
 static void call_console_drivers(const char *ext_text, size_t ext_len,
-const char *text, size_t len) {}
+const char *text, size_t len, int level) {}
 static size_t msg_print_text(const struct printk_log *msg,
 bool syslog, char *buf, size_t size) { 

[PATCH 2/3] printk: Add /sys/consoles/ interface

2017-09-28 Thread Calvin Owens
This adds a new sysfs interface that contains a directory for each
console registered on the system. Each directory contains a single
"loglevel" file for reading and setting the per-console loglevel.

We can let kobject destruction race with console removal: if it does,
loglevel_{show,store}() will safely fail with -ENODEV. This is a little
weird, but avoids embedding the kobject and therefore needing to totally
refactor the way we handle console struct lifetime.

Cc: Petr Mladek 
Cc: Steven Rostedt 
Cc: Sergey Senozhatsky 
Signed-off-by: Calvin Owens 
---
(V1: https://lkml.org/lkml/2017/4/4/784)

Changes in V2:
* Honor minimum_console_loglevel when setting loglevels
* Added entry in Documentation/ABI/testing

 Documentation/ABI/testing/sysfs-consoles | 13 +
 include/linux/console.h  |  1 +
 kernel/printk/printk.c   | 88 
 3 files changed, 102 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-consoles

diff --git a/Documentation/ABI/testing/sysfs-consoles 
b/Documentation/ABI/testing/sysfs-consoles
new file mode 100644
index 000..6a1593e
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-consoles
@@ -0,0 +1,13 @@
+What:  /sys/consoles/
+Date:  September 2017
+KernelVersion: 4.15
+Contact:   Calvin Owens 
+Description:   The /sys/consoles tree contains a directory for each console
+   configured on the system. These directories contain the
+   following attributes:
+
+   * "loglevel"Set the per-console loglevel: the kernel uses
+   max(system_loglevel, perconsole_loglevel) when
+   deciding whether to emit a given message. The
+   default is 0, which means max() always yields
+   the system setting in the kernel.printk sysctl.
diff --git a/include/linux/console.h b/include/linux/console.h
index a5b5d79..76840be 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -148,6 +148,7 @@ struct console {
void*data;
struct   console *next;
int level;
+   struct kobject *kobj;
 };
 
 /*
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3f1675e..488bda3 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -105,6 +105,8 @@ enum devkmsg_log_masks {
 
 static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
 
+static struct kobject *consoles_dir_kobj;
+
 static int __control_devkmsg(char *str)
 {
if (!str)
@@ -2371,6 +2373,82 @@ static int __init keep_bootcon_setup(char *str)
 
 early_param("keep_bootcon", keep_bootcon_setup);
 
+static ssize_t loglevel_show(struct kobject *kobj, struct kobj_attribute *attr,
+char *buf)
+{
+   struct console *con;
+   ssize_t ret = -ENODEV;
+
+   console_lock();
+   for_each_console(con) {
+   if (con->kobj == kobj) {
+   ret = sprintf(buf, "%d\n", con->level);
+   break;
+   }
+   }
+   console_unlock();
+
+   return ret;
+}
+
+static ssize_t loglevel_store(struct kobject *kobj, struct kobj_attribute 
*attr,
+ const char *buf, size_t count)
+{
+   struct console *con;
+   ssize_t ret;
+   int tmp;
+
+   ret = kstrtoint(buf, 10, );
+   if (ret < 0)
+   return ret;
+
+   if (tmp < LOGLEVEL_EMERG)
+   return -ERANGE;
+
+   /*
+* Mimic the behavior of /dev/kmsg with respect to minimum_loglevel
+*/
+   if (tmp < minimum_console_loglevel)
+   tmp = minimum_console_loglevel;
+
+   ret = -ENODEV;
+   console_lock();
+   for_each_console(con) {
+   if (con->kobj == kobj) {
+   con->level = tmp;
+   ret = count;
+   break;
+   }
+   }
+   console_unlock();
+
+   return ret;
+}
+
+static const struct kobj_attribute console_loglevel_attr =
+   __ATTR(loglevel, 0644, loglevel_show, loglevel_store);
+
+static void console_register_sysfs(struct console *newcon)
+{
+   /*
+* We might be called very early from register_console(): in that case,
+* printk_late_init() will take care of this later.
+*/
+   if (!consoles_dir_kobj)
+   return;
+
+   newcon->kobj = kobject_create_and_add(newcon->name, consoles_dir_kobj);
+   if (WARN_ON(!newcon->kobj))
+   return;
+
+   WARN_ON(sysfs_create_file(newcon->kobj, _loglevel_attr.attr));
+}
+
+static void console_unregister_sysfs(struct console *oldcon)
+{
+   kobject_put(oldcon->kobj);
+}
+
 /*
  * The console driver calls this routine during kernel initialization
  * 

[PATCH 3/3] printk: Add ability to set loglevel via "console=" cmdline

2017-09-28 Thread Calvin Owens
This extends the "console=" interface to allow setting the per-console
loglevel by adding "/N" to the string, where N is the desired loglevel
expressed as a base 10 integer. Invalid values are silently ignored.

Cc: Petr Mladek 
Cc: Steven Rostedt 
Cc: Sergey Senozhatsky 
Signed-off-by: Calvin Owens 
---
 Documentation/admin-guide/kernel-parameters.txt |  6 ++---
 kernel/printk/console_cmdline.h |  1 +
 kernel/printk/printk.c  | 30 -
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 0549662..f22b992 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -607,10 +607,10 @@
ttyS[,options]
ttyUSB0[,options]
Use the specified serial port.  The options are of
-   the form "pnf", where "" is the baud rate,
+   the form "pnf/l", where "" is the baud rate,
"p" is parity ("n", "o", or "e"), "n" is number of
-   bits, and "f" is flow control ("r" for RTS or
-   omit it).  Default is "9600n8".
+   bits, "f" is flow control ("r" for RTS or omit it),
+   and "l" is the loglevel on [0,7]. Default is "9600n8".
 
See Documentation/admin-guide/serial-console.rst for 
more
information.  See
diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h
index 2ca4a8b..269e666 100644
--- a/kernel/printk/console_cmdline.h
+++ b/kernel/printk/console_cmdline.h
@@ -5,6 +5,7 @@ struct console_cmdline
 {
charname[16];   /* Name of the driver   */
int index;  /* Minor dev. to use*/
+   int loglevel;   /* Loglevel to use */
char*options;   /* Options for the driver   */
 #ifdef CONFIG_A11Y_BRAILLE_CONSOLE
char*brl_options;   /* Options for braille driver */
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 488bda3..4c14cf2 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1892,7 +1892,7 @@ asmlinkage __visible void early_printk(const char *fmt, 
...)
 #endif
 
 static int __add_preferred_console(char *name, int idx, char *options,
-  char *brl_options)
+  int loglevel, char *brl_options)
 {
struct console_cmdline *c;
int i;
@@ -1918,6 +1918,7 @@ static int __add_preferred_console(char *name, int idx, 
char *options,
c->options = options;
braille_set_options(c, brl_options);
 
+   c->loglevel = loglevel;
c->index = idx;
return 0;
 }
@@ -1928,8 +1929,8 @@ static int __add_preferred_console(char *name, int idx, 
char *options,
 static int __init console_setup(char *str)
 {
char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for "ttyS" */
-   char *s, *options, *brl_options = NULL;
-   int idx;
+   char *s, *options, *llevel, *brl_options = NULL;
+   int idx, loglevel = LOGLEVEL_EMERG;
 
if (_braille_console_setup(, _options))
return 1;
@@ -1947,6 +1948,14 @@ static int __init console_setup(char *str)
options = strchr(str, ',');
if (options)
*(options++) = 0;
+
+   llevel = strchr(str, '/');
+   if (llevel) {
+   *(llevel++) = 0;
+   if (kstrtoint(llevel, 10, ))
+   loglevel = LOGLEVEL_EMERG;
+   }
+
 #ifdef __sparc__
if (!strcmp(str, "ttya"))
strcpy(buf, "ttyS0");
@@ -1959,7 +1968,7 @@ static int __init console_setup(char *str)
idx = simple_strtoul(s, NULL, 10);
*s = 0;
 
-   __add_preferred_console(buf, idx, options, brl_options);
+   __add_preferred_console(buf, idx, options, loglevel, brl_options);
console_set_on_cmdline = 1;
return 1;
 }
@@ -1980,7 +1989,8 @@ __setup("console=", console_setup);
  */
 int add_preferred_console(char *name, int idx, char *options)
 {
-   return __add_preferred_console(name, idx, options, NULL);
+   return __add_preferred_console(name, idx, options, LOGLEVEL_EMERG,
+  NULL);
 }
 
 bool console_suspend_enabled = true;
@@ -2475,6 +2485,7 @@ void register_console(struct console *newcon)
struct console *bcon = NULL;
struct console_cmdline *c;
static bool has_preferred;
+   bool extant = false;
 
if (console_drivers)
for_each_console(bcon)
@@ -2541,6 +2552,12 @@ void register_console(struct console 

Re: [PATCH] arm64: fix documentation on kernel pages mappings to HYP VA

2017-09-28 Thread Yury Norov
On Wed, Sep 27, 2017 at 10:13:33AM +0100, Will Deacon wrote:
> On Wed, Sep 27, 2017 at 09:31:41AM +0100, Marc Zyngier wrote:
> > On Tue, Sep 26 2017 at  9:45:42 pm BST, Yury Norov 
> >  wrote:
> > > On Wed, Sep 13, 2017 at 09:08:30PM +0300, Yury Norov wrote:
> > >> The Documentation/arm64/memory.txt says:
> > >> When using KVM, the hypervisor maps kernel pages in EL2, at a fixed
> > >> offset from the kernel VA (top 24bits of the kernel VA set to zero):
> > >> 
> > >> In fact, kernel addresses are transleted to HYP with kern_hyp_va macro,
> > >> which has more options, and none of them assumes clearing of top 24bits
> > >> of the kernel VA.
> > >> 
> > >> Signed-off-by: Yury Norov 
> > >> ---
> > >>  Documentation/arm64/memory.txt | 15 +--
> > >>  1 file changed, 9 insertions(+), 6 deletions(-)
> > >> 
> > >> diff --git a/Documentation/arm64/memory.txt 
> > >> b/Documentation/arm64/memory.txt
> > >> index d7273a5f6456..c39895d7e3a2 100644
> > >> --- a/Documentation/arm64/memory.txt
> > >> +++ b/Documentation/arm64/memory.txt
> > >> @@ -86,9 +86,12 @@ Translation table lookup with 64KB pages:
> > >>   +-> [63] TTBR0/1
> > >>  
> > >>  
> > >> -When using KVM, the hypervisor maps kernel pages in EL2, at a fixed
> > >> -offset from the kernel VA (top 24bits of the kernel VA set to zero):
> > >> -
> > >> -Start   End SizeUse
> > >> 
> > >> -0040007f 256GB  kernel 
> > >> objects mapped in HYP
> > >> +When using KVM without Virtualization Host Extensions, the hypervisor 
> > >> maps
> > >> +kernel pages in EL2, at a fixed offset from the kernel VA. Namely, top 
> > >> 16
> > >> +or 25 bits of the kernel VA set to zero depending on ARM64_VA_BITS_48 or
> > >> +ARM64_VA_BITS_39 config option selected; or top 17 or 26 bits of the 
> > >> kernel
> > >> +VA set to zero if CPU has Reduced HYP mapping offset capability. See
> > >> +kern_hyp_va macro.
> > 
> > What is this "Reduced HYP mapping offset capability"?

This is the description of ARM64_HYP_OFFSET_LOW capability in
arch/arm64/kernel/cpufeature.c

> > You're missing the point that the location of the EL2 mapping is
> > conditioned by the location of the identity mapping that is used to
> > bring up / tear down KVM. You have to express the VA transformation in
> > terms of both VA_BITS (and there is more cases than just 39 or 48 bits)
> > *and* the idmap address, not to mention the case where KVM's VA_BITS is
> > larger than the rest of the kernel. See the extensive blurb in
> > kvm_mmu.h.
> > 
> > >> +
> > >> +When using KVM with Virtualization Host Extensions, no additional 
> > >> mappings
> > >> +created as host kernel already operates in EL2.
> > 
> > This bit is fine.
> 
> FWIW, I was going to queue a simplified version along the lines of the patch
> below.
> 
> Will

Thanks.

Yury

> --->8
> 
> commit dbf7393b7738a0ba0284551e7b6e014cfb100661
> Author: Yury Norov 
> Date:   Wed Sep 13 21:08:30 2017 +0300
> 
> arm64: fix documentation on kernel pages mappings to HYP VA
> 
> The Documentation/arm64/memory.txt says:
> When using KVM, the hypervisor maps kernel pages in EL2, at a fixed
> offset from the kernel VA (top 24bits of the kernel VA set to zero):
> 
> In fact, kernel addresses are transleted to HYP with kern_hyp_va macro,
> which has more options, and none of them assumes clearing of top 24bits
> of the kernel VA.
> 
> Signed-off-by: Yury Norov 
> [will: removed gory details]
> Signed-off-by: Will Deacon 
> 
> diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt
> index d7273a5f6456..ea9ee39784a2 100644
> --- a/Documentation/arm64/memory.txt
> +++ b/Documentation/arm64/memory.txt
> @@ -86,9 +86,9 @@ Translation table lookup with 64KB pages:
>   +-> [63] TTBR0/1
>  
>  
> -When using KVM, the hypervisor maps kernel pages in EL2, at a fixed
> -offset from the kernel VA (top 24bits of the kernel VA set to zero):
> +When using KVM without the Virtualization Host Extensions, the hypervisor
> +maps kernel pages in EL2 at a fixed offset from the kernel VA. See the
> +kern_hyp_va macro for more details.
>  
> -StartEnd SizeUse
> 
> -0040 007f 256GB  kernel objects 
> mapped in HYP
> +When using KVM with the Virtualization Host Extensions, no additional
> +mappings are created, since the host kernel runs directly in EL2.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to 

Re: Vibrations in input vs. LED was Re: [PATCH v2 0/3] led: ledtrig-transient: add support for hrtimer

2017-09-28 Thread David Lin
On Wed, Sep 27, 2017 at 10:43 PM, Dmitry Torokhov
 wrote:
>>One thing I noticed is that input_ff_create_memless() also does not
>>use high-resolution timer hence it also does not have the stop-time
>>precision that I'm looking for.
>
> I'll take patches for high resolution timers in ff memless, they should also 
> help with more accurate scheduling of ramping up and fading of events.

Thanks.

>
>>
>>Another thing is that ff_reply duration value is maxed-out at 32767 ms
>>(u16) while the Android/userspace requires size long for performing
>>long notification alert.
>>
>
> You need unattended vibrations lasting longer than 30 seconds? Anyway, 
> replay.length == 0 means endless IIRC, so you only need to schedule stopping. 
> We still will clean up properly if your process crashes or exits or closes 
> the fd.

Yes, it's up to the application to vibrate for as long as it requires.
Is there any concern making the duration variable a type long? [If
this is getting off-topic, I'll follow up with another email]
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 12/13] scripts: kernel-doc: handle nested struct function arguments

2017-09-28 Thread Markus Heiser
Hi Mauro,

this 'else' addition seems a bit spooky to me. As I commented in patch 09/13
may it helps when you look at 

  https://github.com/return42/linuxdoc/blob/master/linuxdoc/kernel_doc.py#L2499

which is IMO a bit more clear.

-- Markus --

> Am 27.09.2017 um 23:10 schrieb Mauro Carvalho Chehab 
> :
> 
> Function arguments are different than usual ones. So, an
> special logic is needed in order to handle such arguments
> on nested structs.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> scripts/kernel-doc | 38 ++
> 1 file changed, 26 insertions(+), 12 deletions(-)
> 
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 713608046d3a..376365d41718 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1015,18 +1015,32 @@ sub dump_struct($$) {
>   $id =~ s/^\*+//;
>   foreach my $arg (split /;/, $content) {
>   next if ($arg =~ m/^\s*$/);
> - my $type = $arg;
> - my $name = $arg;
> - $type =~ s/\s\S+$//;
> - $name =~ s/.*\s//;
> - $name =~ s/[:\[].*//;
> - $name =~ s/^\*+//;
> - next if (($name =~ m/^\s*$/));
> - if ($id =~ m/^\s*$/) {
> - # anonymous struct/union
> - $newmember .= "$type $name;";
> + if ($arg =~ 
> m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
> + # pointer-to-function
> + my $type = $1;
> + my $name = $2;
> + my $extra = $3;
> + next if (!$name);
> + if ($id =~ m/^\s*$/) {
> + # anonymous struct/union
> + $newmember .= 
> "$type$name$extra;";
> + } else {
> + $newmember .= 
> "$type$id.$name$extra;";
> + }
>   } else {
> - $newmember .= "$type $id.$name;";
> + my $type = $arg;
> + my $name = $arg;
> + $type =~ s/\s\S+$//;
> + $name =~ s/.*\s+//;
> + $name =~ s/[:\[].*//;
> + $name =~ s/^\*+//;
> + next if (($name =~ m/^\s*$/));
> + if ($id =~ m/^\s*$/) {
> + # anonymous struct/union
> + $newmember .= "$type $name;";
> + } else {
> + $newmember .= "$type 
> $id.$name;";
> + }
>   }
>   }
>   $members =~ 
> s/(struct|union)([^{};]+){([^{}]*)}([^{}\;]*)\;/$newmember/;
> @@ -1215,7 +1229,7 @@ sub create_parameterlist() {
>   } elsif ($arg =~ m/\(.+\)\s*\(/) {
>   # pointer-to-function
>   $arg =~ tr/#/,/;
> - $arg =~ m/[^\(]+\(\*?\s*(\w*)\s*\)/;
> + $arg =~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/;
>   $param = $1;
>   $type = $arg;
>   $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
> -- 
> 2.13.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-doc" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 09/13] scripts: kernel-doc: parse next structs/unions

2017-09-28 Thread Markus Heiser
Hi Mauro,

> Am 27.09.2017 um 23:10 schrieb Mauro Carvalho Chehab 
> :
> 
> 
> 
> diff --git a/Documentation/doc-guide/kernel-doc.rst 
> b/Documentation/doc-guide/kernel-doc.rst
> index 96012f9e314d..9e63a18cceea 100644
> --- a/Documentation/doc-guide/kernel-doc.rst
> +++ b/Documentation/doc-guide/kernel-doc.rst
> @@ -281,6 +281,52 @@ comment block.
> The kernel-doc data structure comments describe each member of the structure,
> in order, with the member descriptions.
> 
> +Nested structs/unions
> +~
> +
> +It is possible to document nested structs unions, like::
> +
> +  /**
> +   * struct nested_foobar - a struct with nested unions and structs
> +   * @arg1: - first argument of anonymous union/anonymous struct
> +   * @arg2: - second argument of anonymous union/anonymous struct
> +   * @arg3: - third argument of anonymous union/anonymous struct
> +   * @arg4: - fourth argument of anonymous union/anonymous struct
> +   * @bar.st1.arg1 - first argument of struct st1 on union bar
> +   * @bar.st1.arg2 - second argument of struct st1 on union bar
> +   * @bar.st2.arg1 - first argument of struct st2 on union bar
> +   * @bar.st2.arg2 - second argument of struct st2 on union bar

Sorry, this example is totally broken --> below I attached a more
elaborate example. I also untabified the example since tabs in reST are
a nightmare, especially in code blocks ... tabulators are the source
of all evil [1] ...

  Please, never use tabs in markups or programming languages
  where indentation is a part of the markup respectively the 
  language!!

> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index b6f3f6962897..63aa9f85d635 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -210,7 +210,7 @@ my $anon_struct_union = 0;
> my $type_constant = '\b``([^\`]+)``\b';
> my $type_constant2 = '\%([-_\w]+)';
> my $type_func = '(\w+)\(\)';
> -my $type_param = '\@(\w+(\.\.\.)?)';
> +my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
> my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
> my $type_env = '(\$\w+)';
> my $type_enum = '\&(enum\s*([_\w]+))';
> @@ -663,32 +663,12 @@ sub output_struct_man(%) {
>print ".SH NAME\n";
>print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . 
> "\n";
> 
> +my $declaration = $args{'definition'};
> +$declaration =~ s/\t/  /g;
> +$declaration =~ s/\n/"\n.br\n.BI \"/g;
>print ".SH SYNOPSIS\n";
>print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
> -
> -foreach my $parameter (@{$args{'parameterlist'}}) {
> - if ($parameter =~ /^#/) {
> - print ".BI \"$parameter\"\n.br\n";
> - next;
> - }
> - my $parameter_name = $parameter;
> - $parameter_name =~ s/\[.*//;
> -
> - ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
> - $type = $args{'parametertypes'}{$parameter};
> - if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
> - # pointer-to-function
> - print ".BI \"" . $1 . "\" " . $parameter . " \") (" . $2 . ")" 
> . "\"\n;\n";
> - } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
> - # bitfield
> - print ".BI \"" . $1 . "\ \" " . $parameter . $2 . " \"" . 
> "\"\n;\n";
> - } else {
> - $type =~ s/([^\*])$/$1 /;
> - print ".BI \"" . $type . "\" " . $parameter . " \"" . "\"\n;\n";
> - }
> - print "\n.br\n";
> -}
> -print "};\n.br\n";
> +print ".BI \"$declaration\n};\n.br\n\n";
> 
>print ".SH Members\n";
>foreach $parameter (@{$args{'parameterlist'}}) {
> @@ -926,29 +906,9 @@ sub output_struct_rst(%) {
> 
>print "**Definition**\n\n";
>print "::\n\n";
> -print "  " . $args{'type'} . " " . $args{'struct'} . " {\n";
> -foreach $parameter (@{$args{'parameterlist'}}) {
> - if ($parameter =~ /^#/) {
> - print "  " . "$parameter\n";
> - next;
> - }
> -
> - my $parameter_name = $parameter;
> - $parameter_name =~ s/\[.*//;
> -
> - ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
> - $type = $args{'parametertypes'}{$parameter};
> - if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
> - # pointer-to-function
> - print "$1 $parameter) ($2);\n";
> - } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
> - # bitfield
> - print "$1 $parameter$2;\n";
> - } else {
> - print "" . $type . " " . $parameter . ";\n";
> - }
> -}
> -print "  };\n\n";
> +my $declaration = $args{'definition'};
> +$declaration =~ s/\t/  /g;
> +print "  " . $args{'type'} . " " . $args{'struct'} . " {\n$declaration  
> };\n\n";
> 
>print "**Members**\n\n";
>$lineprefix = "  ";
> @@ -1022,20 +982,15 @@ sub dump_struct($$) {
>my $nested;
> 
>if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
> - #my $decl_type = $1;
> + my $decl_type = $1;
>   

Re: [PATCH] docs: clean up and add rest of CRC functions to kernel-api.rst

2017-09-28 Thread Jonathan Corbet
On Fri, 8 Sep 2017 16:35:55 -0700
Randy Dunlap  wrote:

> Add the rest of the CRC library functions to kernel-api.
> 
> - try to clarify crc32() by adding '@' to a function parameter
> - reorder kernel-api CRC functions to be less random
> - add more CRC functions to kernel-api
> - correct the function parameter names in several places

I've applied this one too; sorry for being so slow.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] Documentation/process: fix the canonical patch format description

2017-09-28 Thread Jonathan Corbet
On Mon, 25 Sep 2017 18:36:19 +0900
Junio C Hamano  wrote:

> There shouldn't be a blank line at the beginning, if there is no
> optional in-body "From" line.  There must be a blank line between
> the body of the explanation and the beginning of the S-o-b lines.

Applied (the second patch as well).

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation: kernel-api: add bitmap operations from linux/bitmap.h

2017-09-28 Thread Jonathan Corbet
On Sun, 17 Sep 2017 19:07:10 -0700
Randy Dunlap  wrote:

> Add  to kernel-api Bitmap Operations section.
> Fix kernel-doc nitpicks in .

Applied, thanks.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] docs: highres: fix broken urls

2017-09-28 Thread Jonathan Corbet
On Tue, 29 Aug 2017 10:42:24 +0800
stephen lu  wrote:

> Some urls is invalid. I find alternative urls.
> 
> Signed-off-by: stephen lu 
> ---
>  Documentation/timers/highres.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I have, rather belatedly, applied this; working URLs are better than
broken ones.  The fact that this file has seen no substantive changes
since 2008 suggests that there may be more work to do here, though...:)

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scripts/kernel-doc: warn on excess enum value descriptions

2017-09-28 Thread Jonathan Corbet
On Tue, 19 Sep 2017 13:08:13 +0200
Johannes Berg  wrote:

> The existing message
>   "Excess struct/union/enum/typedef member [...]"
> made it sound like this would already be done, but the
> code is never invoked for enums or typedefs (and really
> can't be).
> 
> Add some code to the enum dumper to handle this there
> instead.
> 
> While at it, also make the above message more accurate
> by simply dumping the type that was passed in, and pass
> the struct/union differentiation in.

I've applied this, thanks.

FWIW, I'd appreciate it if you'd copy me on docs patches; I have a much
higher probability of actually seeing them that way.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation: fix little inconsistencies

2017-09-28 Thread Jonathan Corbet
On Sat, 16 Sep 2017 13:48:37 +0200
Pavel Machek  wrote:

> Fix little inconsistencies in Documentation: make case and spacing
> match surrounding text.

Applied to the docs tree, thanks.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Documentation: kernel-api: drop "Data Types" section

2017-09-28 Thread Jonathan Corbet
On Sun, 17 Sep 2017 15:19:10 -0700
Randy Dunlap  wrote:

> In the kernel-api chapter, the section for Data Types only
> contains "Doubly Linked Lists" and all of the function interfaces
> for list management.  There are no other data types in this section,
> so collapse this section into "List Management Functions".

Applied, thanks.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] console: Update to reflect new default value

2017-09-28 Thread Jonathan Corbet
On Mon, 18 Sep 2017 22:21:25 -0700
Daniel Xu  wrote:

> The default value was changed from 10 minutes to disabled in commit
> a4199f5eb8096d6.
> 
> Signed-off-by: Daniel Xu 
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to the docs tree, thanks.

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/10] scripts: kernel-doc: parse next structs/unions

2017-09-28 Thread Jonathan Corbet
On Tue, 26 Sep 2017 17:29:47 -0300
Mauro Carvalho Chehab  wrote:

> This patch actually need a fixup, in order to handle pointer,
> array and bitmask IDs.

Can you send a new series with the fixed patch?

I sure do like the shrinking of kernel-doc that comes with this series!  

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] hwmon: (ina2xx) Make max expected current configurable

2017-09-28 Thread Guenter Roeck

On 09/28/2017 05:50 AM, Maciej Purski wrote:

Max expected current is used for calculating calibration register value,
Current LSB and Power LSB according to equations found in ina datasheet.
Max expected current is now implicitly set to default value,
which is 2^15, thanks to which Current LSB is equal to 1 mA and
Power LSB is equal to 2 uW or 25000 uW depending on ina model.

Make max expected current configurable, just like it's already done
with shunt resistance: from device tree, platform_data or later
from sysfs. On each max_expected_current change, calculate new values
for Current LSB and Power LSB. According to datasheet Current LSB should
be calculated by dividing max expected current by 2^15, as values read
from device registers are in this case 16-bit integers. Power LSB
is calculated by multiplying Current LSB by a factor, which is defined
in ina documentation.

Signed-off-by: Maciej Purski 
---
  drivers/hwmon/ina2xx.c | 105 +++--
  1 file changed, 93 insertions(+), 12 deletions(-)

diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index 62e38fa..d956013 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -80,6 +80,8 @@
  /* common attrs, ina226 attrs and NULL */
  #define INA2XX_MAX_ATTRIBUTE_GROUPS   3
  
+#define INA2XX_MAX_EXPECTED_A_DEFAULT  (1 << 15)   /* current_lsb = 1 mA */

+
  /*
   * Both bus voltage and shunt voltage conversion times for ina226 are set
   * to 0b0100 on POR, which translates to 2200 microseconds in total.
@@ -100,13 +102,16 @@ struct ina2xx_config {
int shunt_div;
int bus_voltage_shift;
int bus_voltage_lsb;/* uV */
-   int power_lsb;  /* uW */
+   int power_lsb_factor;
  };
  
  struct ina2xx_data {

const struct ina2xx_config *config;
  
-	long rshunt;

+   long rshunt;/* uOhms */
+   unsigned int max_expected_current;  /* mA */
+   int current_lsb;/* uA */
+   int power_lsb;  /* uW */
struct mutex config_lock;
struct regmap *regmap;
  
@@ -121,7 +126,7 @@ static const struct ina2xx_config ina2xx_config[] = {

.shunt_div = 100,
.bus_voltage_shift = 3,
.bus_voltage_lsb = 4000,
-   .power_lsb = 2,
+   .power_lsb_factor = 20,
},
[ina226] = {
.config_default = INA226_CONFIG_DEFAULT,
@@ -130,7 +135,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.shunt_div = 400,
.bus_voltage_shift = 0,
.bus_voltage_lsb = 1250,
-   .power_lsb = 25000,
+   .power_lsb_factor = 25,
},
  };
  
@@ -169,10 +174,17 @@ static u16 ina226_interval_to_reg(int interval)

return INA226_SHIFT_AVG(avg_bits);
  }
  
+/*

+ * Calculate calibration value according to equation 1 in ina226 datasheet
+ * http://www.ti.com/lit/ds/symlink/ina226.pdf.
+ * Current LSB is in uA and RShunt is in uOhms, so in order to keep
+ * calibration value scaled RShunt must be converted to mOhms.
+ */
  static int ina2xx_calibrate(struct ina2xx_data *data)
  {
+   int r_shunt = DIV_ROUND_CLOSEST(data->rshunt, 1000);
u16 val = DIV_ROUND_CLOSEST(data->config->calibration_factor,
-   data->rshunt);
+   data->current_lsb * r_shunt);
  
  	return regmap_write(data->regmap, INA2XX_CALIBRATION, val);

  }
@@ -187,13 +199,28 @@ static int ina2xx_init(struct ina2xx_data *data)
if (ret < 0)
return ret;
  
-	/*

-* Set current LSB to 1mA, shunt is in uOhms
-* (equation 13 in datasheet).
-*/
return ina2xx_calibrate(data);
  }
  
+/*

+ * Set max_expected_current (mA) and calculate current_lsb (uA),
+ * according to equation 2 in ina226 datasheet. Power LSB is calculated
+ * by multiplying Current LSB by a given factor, which may vary depending
+ * on ina version.
+ */
+static int set_max_expected_current(struct ina2xx_data *data, unsigned int val)
+{
+   if (val <= 0 || val > data->config->calibration_factor)
+   return -EINVAL;
+
+   data->max_expected_current = val;
+   data->current_lsb = DIV_ROUND_CLOSEST(data->max_expected_current * 1000,
+ 1 << 15);
+   data->power_lsb = data->current_lsb * data->config->power_lsb_factor;
+
+   return 0;
+}
+
  static int ina2xx_read_reg(struct device *dev, int reg, unsigned int *regval)
  {
struct ina2xx_data *data = dev_get_drvdata(dev);
@@ -268,11 +295,11 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 
reg,
val = DIV_ROUND_CLOSEST(val, 1000);
break;
case INA2XX_POWER:
-   val = regval * data->config->power_lsb;
+   val = regval * 

Re: [RESEND PATCH v2 13/17] media: v4l2-async: simplify v4l2_async_subdev structure

2017-09-28 Thread Sylwester Nawrocki
On 09/28/2017 02:53 PM, Mauro Carvalho Chehab wrote:
> (Resending for Mauro, while dropping the non-list recipients. The original
> likely had too many recipients.)
> 
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.
> 
> At drivers, this makes even clearer about the match criteria.
> 
> Signed-off-by: Mauro Carvalho Chehab 


Acked-by: Sylwester Nawrocki 
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH v2 13/17] media: v4l2-async: simplify v4l2_async_subdev structure

2017-09-28 Thread Sakari Ailus
Hi Mauro,

On Wed, Sep 27, 2017 at 06:46:56PM -0300, Mauro Carvalho Chehab wrote:
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.

The idea is that in the union, there's a struct which is specific to the
match_type field. I wouldn't call it senseless.

In the two cases there's just a single field in the containing struct. You
could remove the struct in that case as you do in this patch, and just use
the field. But I think the result is less clean and so I wouldn't make this
change.

The confusion comes possibly from the fact that the struct is named the
same as the field in the struct. These used to be called of and node, but
with the fwnode property framework the references to the fwnode are, well,
typically similarly called "fwnode". There's no underlying firmware
interface with that name, fwnode property API is just an API.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND PATCH v2 13/17] media: v4l2-async: simplify v4l2_async_subdev structure

2017-09-28 Thread Mauro Carvalho Chehab
(Resending for Mauro, while dropping the non-list recipients. The original
likely had too many recipients.)

The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
match criteria requires just a device name.

So, it doesn't make sense to enclose those into structs,
as the criteria can go directly into the union.

That makes easier to document it, as we don't need to document
weird senseless structs.

At drivers, this makes even clearer about the match criteria.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/platform/am437x/am437x-vpfe.c| 6 +++---
 drivers/media/platform/atmel/atmel-isc.c   | 2 +-
 drivers/media/platform/atmel/atmel-isi.c   | 2 +-
 drivers/media/platform/davinci/vpif_capture.c  | 4 ++--
 drivers/media/platform/exynos4-is/media-dev.c  | 4 ++--
 drivers/media/platform/omap3isp/isp.c  | 4 ++--
 drivers/media/platform/pxa_camera.c| 2 +-
 drivers/media/platform/qcom/camss-8x16/camss.c | 2 +-
 drivers/media/platform/rcar-vin/rcar-core.c| 8 
 drivers/media/platform/rcar_drif.c | 4 ++--
 drivers/media/platform/soc_camera/soc_camera.c | 2 +-
 drivers/media/platform/stm32/stm32-dcmi.c  | 2 +-
 drivers/media/platform/ti-vpe/cal.c| 2 +-
 drivers/media/platform/xilinx/xilinx-vipp.c| 2 +-
 drivers/media/v4l2-core/v4l2-async.c   | 4 ++--
 drivers/staging/media/imx/imx-media-dev.c  | 8 
 include/media/v4l2-async.h | 8 ++--
 17 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/drivers/media/platform/am437x/am437x-vpfe.c 
b/drivers/media/platform/am437x/am437x-vpfe.c
index dfcc484cab89..f87e8f9467e9 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2304,8 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
 
for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
-   if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
-   asd[i].match.fwnode.fwnode) {
+   if (vpfe->cfg->asd[i]->match.fwnode ==
+   asd[i].match.fwnode) {
sdinfo = >cfg->sub_devs[i];
vpfe->sd[i] = subdev;
vpfe->sd[i]->grp_id = sdinfo->grp_id;
@@ -2505,7 +2505,7 @@ vpfe_get_pdata(struct platform_device *pdev)
}
 
pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
-   pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
+   pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
of_node_put(rem);
}
 
diff --git a/drivers/media/platform/atmel/atmel-isc.c 
b/drivers/media/platform/atmel/atmel-isc.c
index d7103c5f92c3..c04d9a4dbfac 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1742,7 +1742,7 @@ static int isc_parse_dt(struct device *dev, struct 
isc_device *isc)
subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW;
 
subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-   subdev_entity->asd->match.fwnode.fwnode =
+   subdev_entity->asd->match.fwnode =
of_fwnode_handle(rem);
list_add_tail(_entity->list, >subdev_entities);
}
diff --git a/drivers/media/platform/atmel/atmel-isi.c 
b/drivers/media/platform/atmel/atmel-isi.c
index 891fa2505efa..8c52f9f5f2db 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -1124,7 +1124,7 @@ static int isi_graph_parse(struct atmel_isi *isi, struct 
device_node *node)
/* Remote node to connect */
isi->entity.node = remote;
isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-   isi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+   isi->entity.asd.match.fwnode = of_fwnode_handle(remote);
return 0;
}
 }
diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index 0ef36cec21d1..0cf141635cbc 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1390,7 +1390,7 @@ static int vpif_async_bound(struct v4l2_async_notifier 
*notifier,
 
for (i = 0; i < vpif_obj.config->asd_sizes[0]; i++) {
struct v4l2_async_subdev *_asd = vpif_obj.config->asd[i];
-   const struct fwnode_handle *fwnode = _asd->match.fwnode.fwnode;
+   const struct fwnode_handle *fwnode = _asd->match.fwnode;
 
if (fwnode == subdev->fwnode) {
vpif_obj.sd[i] = subdev;
@@ -1588,7 +1588,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
}
 
  

[PATCH 3/4] dt-bindings: hwmon: Add max-expected-current property to ina2xx

2017-09-28 Thread Maciej Purski
Add optional max expected current property which allows calibrating
the ina sensor in order to achieve requested precision. Document
the changes in Documentation/hwmon/ina2xx.

Signed-off-by: Maciej Purski 
---
 Documentation/devicetree/bindings/hwmon/ina2xx.txt | 4 +++-
 Documentation/hwmon/ina2xx | 9 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/hwmon/ina2xx.txt 
b/Documentation/devicetree/bindings/hwmon/ina2xx.txt
index 02af0d9..25ba372 100644
--- a/Documentation/devicetree/bindings/hwmon/ina2xx.txt
+++ b/Documentation/devicetree/bindings/hwmon/ina2xx.txt
@@ -14,11 +14,13 @@ Optional properties:
 
 - shunt-resistor
Shunt resistor value in micro-Ohm
-
+- max-expected-current
+   Max expected current value in mA
 Example:
 
 ina220@44 {
compatible = "ti,ina220";
reg = <0x44>;
shunt-resistor = <1000>;
+   max-expected-current = <3000>;
 };
diff --git a/Documentation/hwmon/ina2xx b/Documentation/hwmon/ina2xx
index cfd31d9..e9ca838 100644
--- a/Documentation/hwmon/ina2xx
+++ b/Documentation/hwmon/ina2xx
@@ -51,10 +51,11 @@ INA230 and INA231 are high or low side current shunt and 
power monitors
 with an I2C interface. The chips monitor both a shunt voltage drop and
 bus supply voltage.
 
-The shunt value in micro-ohms can be set via platform data or device tree at
-compile-time or via the shunt_resistor attribute in sysfs at run-time. Please
-refer to the Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings
-if the device tree is used.
+The shunt value in micro-ohms and max expected current in mA can be set
+via platform data or device tree at compile-time or via the shunt_resistor
+and max_expected_current attributes in sysfs at run-time. Please refer to the
+Documentation/devicetree/bindings/i2c/ina2xx.txt for bindings if the
+device tree is used.
 
 Additionally ina226 supports update_interval attribute as described in
 Documentation/hwmon/sysfs-interface. Internally the interval is the sum of
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] ARM: dts: Add max-expected-current properties for ina231 in Odroid XU3

2017-09-28 Thread Maciej Purski
Set max-expected-current to values required by the documentation,
in order to achieve desired precision.

Signed-off-by: Maciej Purski 
---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts 
b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index 9ed6564..aa19374 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
@@ -28,6 +28,7 @@
compatible = "ti,ina231";
reg = <0x40>;
shunt-resistor = <1>;
+   max-expected-current = <9000>;
};
 
/* memory: VDD_MEM */
@@ -35,6 +36,7 @@
compatible = "ti,ina231";
reg = <0x41>;
shunt-resistor = <1>;
+   max-expected-current = <3000>;
};
 
/* GPU: VDD_G3D */
@@ -42,6 +44,7 @@
compatible = "ti,ina231";
reg = <0x44>;
shunt-resistor = <1>;
+   max-expected-current = <5000>;
};
 
/* A7 cluster: VDD_KFC */
@@ -49,6 +52,7 @@
compatible = "ti,ina231";
reg = <0x45>;
shunt-resistor = <1>;
+   max-expected-current = <2000>;
};
 };
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] hwmon: (ina2xx) Make max expected current configurable

2017-09-28 Thread Maciej Purski
Max expected current is used for calculating calibration register value,
Current LSB and Power LSB according to equations found in ina datasheet.
Max expected current is now implicitly set to default value,
which is 2^15, thanks to which Current LSB is equal to 1 mA and
Power LSB is equal to 2 uW or 25000 uW depending on ina model.

Make max expected current configurable, just like it's already done
with shunt resistance: from device tree, platform_data or later
from sysfs. On each max_expected_current change, calculate new values
for Current LSB and Power LSB. According to datasheet Current LSB should
be calculated by dividing max expected current by 2^15, as values read
from device registers are in this case 16-bit integers. Power LSB
is calculated by multiplying Current LSB by a factor, which is defined
in ina documentation.

Signed-off-by: Maciej Purski 
---
 drivers/hwmon/ina2xx.c | 105 +++--
 1 file changed, 93 insertions(+), 12 deletions(-)

diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index 62e38fa..d956013 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -80,6 +80,8 @@
 /* common attrs, ina226 attrs and NULL */
 #define INA2XX_MAX_ATTRIBUTE_GROUPS3
 
+#define INA2XX_MAX_EXPECTED_A_DEFAULT  (1 << 15)   /* current_lsb = 1 mA */
+
 /*
  * Both bus voltage and shunt voltage conversion times for ina226 are set
  * to 0b0100 on POR, which translates to 2200 microseconds in total.
@@ -100,13 +102,16 @@ struct ina2xx_config {
int shunt_div;
int bus_voltage_shift;
int bus_voltage_lsb;/* uV */
-   int power_lsb;  /* uW */
+   int power_lsb_factor;
 };
 
 struct ina2xx_data {
const struct ina2xx_config *config;
 
-   long rshunt;
+   long rshunt;/* uOhms */
+   unsigned int max_expected_current;  /* mA */
+   int current_lsb;/* uA */
+   int power_lsb;  /* uW */
struct mutex config_lock;
struct regmap *regmap;
 
@@ -121,7 +126,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.shunt_div = 100,
.bus_voltage_shift = 3,
.bus_voltage_lsb = 4000,
-   .power_lsb = 2,
+   .power_lsb_factor = 20,
},
[ina226] = {
.config_default = INA226_CONFIG_DEFAULT,
@@ -130,7 +135,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.shunt_div = 400,
.bus_voltage_shift = 0,
.bus_voltage_lsb = 1250,
-   .power_lsb = 25000,
+   .power_lsb_factor = 25,
},
 };
 
@@ -169,10 +174,17 @@ static u16 ina226_interval_to_reg(int interval)
return INA226_SHIFT_AVG(avg_bits);
 }
 
+/*
+ * Calculate calibration value according to equation 1 in ina226 datasheet
+ * http://www.ti.com/lit/ds/symlink/ina226.pdf.
+ * Current LSB is in uA and RShunt is in uOhms, so in order to keep
+ * calibration value scaled RShunt must be converted to mOhms.
+ */
 static int ina2xx_calibrate(struct ina2xx_data *data)
 {
+   int r_shunt = DIV_ROUND_CLOSEST(data->rshunt, 1000);
u16 val = DIV_ROUND_CLOSEST(data->config->calibration_factor,
-   data->rshunt);
+   data->current_lsb * r_shunt);
 
return regmap_write(data->regmap, INA2XX_CALIBRATION, val);
 }
@@ -187,13 +199,28 @@ static int ina2xx_init(struct ina2xx_data *data)
if (ret < 0)
return ret;
 
-   /*
-* Set current LSB to 1mA, shunt is in uOhms
-* (equation 13 in datasheet).
-*/
return ina2xx_calibrate(data);
 }
 
+/*
+ * Set max_expected_current (mA) and calculate current_lsb (uA),
+ * according to equation 2 in ina226 datasheet. Power LSB is calculated
+ * by multiplying Current LSB by a given factor, which may vary depending
+ * on ina version.
+ */
+static int set_max_expected_current(struct ina2xx_data *data, unsigned int val)
+{
+   if (val <= 0 || val > data->config->calibration_factor)
+   return -EINVAL;
+
+   data->max_expected_current = val;
+   data->current_lsb = DIV_ROUND_CLOSEST(data->max_expected_current * 1000,
+ 1 << 15);
+   data->power_lsb = data->current_lsb * data->config->power_lsb_factor;
+
+   return 0;
+}
+
 static int ina2xx_read_reg(struct device *dev, int reg, unsigned int *regval)
 {
struct ina2xx_data *data = dev_get_drvdata(dev);
@@ -268,11 +295,11 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 
reg,
val = DIV_ROUND_CLOSEST(val, 1000);
break;
case INA2XX_POWER:
-   val = regval * data->config->power_lsb;
+   val = regval * data->power_lsb;
break;
case INA2XX_CURRENT:
- 

[PATCH 1/4] iio: adc: ina2xx: Make max expected current configurable

2017-09-28 Thread Maciej Purski
Max expected current is used for calculating calibration register value,
Current LSB and Power LSB according to equations found in ina datasheet.
Max expected current is now implicitly set to default value,
which is 2^15, thanks to which Current LSB is equal to 1 mA and
Power LSB is equal to 2 uW or 25000 uW depending on ina model.

Make max expected current configurable, just like it's already done
with shunt resistance: from device tree, platform_data or later
from sysfs. On each max_expected_current change, calculate new values
for Current LSB and Power LSB. According to datasheet Current LSB should
be calculated by dividing max expected current by 2^15, as values read
from device registers are in this case 16-bit integers. Power LSB
is calculated by multiplying Current LSB by a factor, which is defined
in ina documentation.

Signed-off-by: Maciej Purski 
---
 drivers/iio/adc/ina2xx-adc.c | 110 ++-
 include/linux/platform_data/ina2xx.h |   2 +
 2 files changed, 98 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index f387b97..883fede 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -56,6 +56,7 @@
 #define INA226_DEFAULT_IT  1110
 
 #define INA2XX_RSHUNT_DEFAULT   1
+#define INA2XX_MAX_EXPECTED_A_DEFAULT  (1 << 15)   /* current_lsb = 1 mA */
 
 /*
  * bit masks for reading the settings in the configuration register
@@ -114,7 +115,7 @@ struct ina2xx_config {
int shunt_div;
int bus_voltage_shift;
int bus_voltage_lsb;/* uV */
-   int power_lsb;  /* uW */
+   int power_lsb_factor;
enum ina2xx_ids chip_id;
 };
 
@@ -123,7 +124,10 @@ struct ina2xx_chip_info {
struct task_struct *task;
const struct ina2xx_config *config;
struct mutex state_lock;
-   unsigned int shunt_resistor;
+   unsigned int shunt_resistor;/* uOhms */
+   unsigned int max_expected_current;  /* mA */
+   int current_lsb;/* uA */
+   int power_lsb;  /* uW */
int avg;
int int_time_vbus; /* Bus voltage integration time uS */
int int_time_vshunt; /* Shunt voltage integration time uS */
@@ -137,7 +141,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.shunt_div = 100,
.bus_voltage_shift = 3,
.bus_voltage_lsb = 4000,
-   .power_lsb = 2,
+   .power_lsb_factor = 20,
.chip_id = ina219,
},
[ina226] = {
@@ -146,7 +150,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.shunt_div = 400,
.bus_voltage_shift = 0,
.bus_voltage_lsb = 1250,
-   .power_lsb = 25000,
+   .power_lsb_factor = 25,
.chip_id = ina226,
},
 };
@@ -210,14 +214,15 @@ static int ina2xx_read_raw(struct iio_dev *indio_dev,
 
case INA2XX_POWER:
/* processed (mW) = raw*lsb (uW) / 1000 */
-   *val = chip->config->power_lsb;
+   *val = chip->power_lsb;
*val2 = 1000;
return IIO_VAL_FRACTIONAL;
 
case INA2XX_CURRENT:
-   /* processed (mA) = raw (mA) */
-   *val = 1;
-   return IIO_VAL_INT;
+   /* processed (mA) = raw*lsb (uA) / 1000 */
+   *val = chip->current_lsb;
+   *val2 = 1000;
+   return IIO_VAL_FRACTIONAL;
}
}
 
@@ -434,24 +439,47 @@ static ssize_t ina2xx_allow_async_readout_store(struct 
device *dev,
 }
 
 /*
- * Set current LSB to 1mA, shunt is in uOhms
- * (equation 13 in datasheet). We hardcode a Current_LSB
- * of 1.0 x10-6. The only remaining parameter is RShunt.
+ * Calculate calibration value according to equation 1 in ina226 datasheet
+ * http://www.ti.com/lit/ds/symlink/ina226.pdf.
+ * Current LSB is in uA and RShunt is in uOhms, so RShunt should be
+ * converted to mOhms in order to keep the scale.
  * There is no need to expose the CALIBRATION register
  * to the user for now. But we need to reset this register
- * if the user updates RShunt after driver init, e.g upon
- * reading an EEPROM/Probe-type value.
+ * if the user updates RShunt or max expected current after driver
+ * init, e.g upon reading an EEPROM/Probe-type value.
  */
 static int ina2xx_set_calibration(struct ina2xx_chip_info *chip)
 {
+   unsigned int rshunt = DIV_ROUND_CLOSEST(chip->shunt_resistor, 1000);
u16 regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor,
-  chip->shunt_resistor);
+chip->current_lsb * rshunt);
 
return 

[PATCH 0/4] Make max expected current configurable for ina2xx drivers

2017-09-28 Thread Maciej Purski
Hi all,

this patchset makes it possible to calibrate ina2xx drivers with different
calibration values, which are calculated using max expected current value.
It can be read from device tree, platform data or changed during run-time
using sysfs. If it isn't specified in device tree or platform data, the
driver uses default value, thanks to which the behaviour of the driver
don't change in this case.

There are two drivers for ina2xx: hwmon and iio. Changes are made
for both of them and their bindings as well.

These changes allow setting sensor's precision to the required by the board.
It is useful in Odroid XU3. Therefore this patchset also sets
max-expected-current in OdroidXU3 device tree to values from documentation.

Best Regards,

Maciej Purski

Maciej Purski (4):
  iio: adc: ina2xx: Make max expected current configurable
  hwmon: (ina2xx) Make max expected current configurable
  dt-bindings: hwmon: Add max-expected-current property to ina2xx
  ARM: dts: Add max-expected-current properties for ina231 in Odroid XU3

 Documentation/devicetree/bindings/hwmon/ina2xx.txt |   4 +-
 Documentation/hwmon/ina2xx |   9 +-
 arch/arm/boot/dts/exynos5422-odroidxu3.dts |   4 +
 drivers/hwmon/ina2xx.c | 105 +---
 drivers/iio/adc/ina2xx-adc.c   | 110 ++---
 include/linux/platform_data/ina2xx.h   |   2 +
 6 files changed, 203 insertions(+), 31 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/17] V4L cleanups and documentation improvements

2017-09-28 Thread Sakari Ailus
Hi Mauro,

On Wed, Sep 27, 2017 at 06:46:43PM -0300, Mauro Carvalho Chehab wrote:
> This patch series is meant to improve V4L documentation. It touches
> some files at the tree doing some cleanup, in order to simplify
> the source code.
> 
> Mauro Carvalho Chehab (17):
>   media: tuner-types: add kernel-doc markups for struct tunertype
>   media: v4l2-common: get rid of v4l2_routing dead struct
>   media: v4l2-common: get rid of struct v4l2_discrete_probe
>   media: v4l2-common.h: document ancillary functions
>   media: v4l2-device.h: document ancillary macros
>   media: v4l2-dv-timings.h: convert comment into kernel-doc markup
>   media: v4l2-event.rst: improve events description
>   media: v4l2-ioctl.h: convert debug macros into enum and document
>   media: cec-pin.h: convert comments for cec_pin_state into kernel-doc
>   media: rc-core.rst: add an introduction for RC core
>   media: rc-core.h: minor adjustments at rc_driver_type doc
>   media: v4l2-fwnode.h: better describe bus union at fwnode endpoint
> struct
>   media: v4l2-async: simplify v4l2_async_subdev structure
>   media: v4l2-async: better describe match union at async match struct
>   media: v4l2-ctrls: document nested members of structs
>   media: videobuf2-core: improve kernel-doc markups
>   media: media-entity.h: add kernel-doc markups for nested structs

For patches apart form 7 and 13 (see my comments to them):

Acked-by: Sakari Ailus 

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 07/17] media: v4l2-event.rst: improve events description

2017-09-28 Thread Sakari Ailus
Hi Mauro,

On Wed, Sep 27, 2017 at 06:46:50PM -0300, Mauro Carvalho Chehab wrote:
> Both v4l2-event.rst and v4l2-event.h have an overview of
> events, but there are some inconsistencies there:
> 
> - at v4l2-event, the event's ringbuffer is called kevent. Its

s/ringbuffer/ring buffer/g

With that,

Acked-by: Sakari Ailus 

>   name is, instead, v4l2_kevent;
> 
> - Some things are mentioned on both places (with different words),
>   others are either on one of the files.
> 
> In order to cleanup this mess, put everything at v4l2-event.rst
> and improve it to be a little more coherent and to have cross
> references.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  Documentation/media/kapi/v4l2-event.rst | 64 
> ++---
>  include/media/v4l2-event.h  | 34 --
>  2 files changed, 52 insertions(+), 46 deletions(-)
> 
> diff --git a/Documentation/media/kapi/v4l2-event.rst 
> b/Documentation/media/kapi/v4l2-event.rst
> index 9938d21ef4d1..7831a503e2aa 100644
> --- a/Documentation/media/kapi/v4l2-event.rst
> +++ b/Documentation/media/kapi/v4l2-event.rst
> @@ -5,27 +5,67 @@ V4L2 events
>  The V4L2 events provide a generic way to pass events to user space.
>  The driver must use :c:type:`v4l2_fh` to be able to support V4L2 events.
>  
> -Events are defined by a type and an optional ID. The ID may refer to a V4L2
> -object such as a control ID. If unused, then the ID is 0.
> +Events are subscribed per-filehandle. An event specification consists of a
> +``type`` and is optionally associated with an object identified through the
> +``id`` field. If unused, then the ``id`` is 0. So an event is uniquely
> +identified by the ``(type, id)`` tuple.
>  
> -When the user subscribes to an event the driver will allocate a number of
> -kevent structs for that event. So every (type, ID) event tuple will have
> -its own set of kevent structs. This guarantees that if a driver is generating
> -lots of events of one type in a short time, then that will not overwrite
> -events of another type.
> +The :c:type:`v4l2_fh` struct has a list of subscribed events on its
> +``subscribed`` field.
>  
> -But if you get more events of one type than the number of kevents that were
> -reserved, then the oldest event will be dropped and the new one added.
> +When the user subscribes to an event, a :c:type:`v4l2_subscribed_event`
> +struct is added to :c:type:`v4l2_fh`\ ``.subscribed``, one for every
> +subscribed event.
> +
> +Each :c:type:`v4l2_subscribed_event` struct ends with a
> +:c:type:`v4l2_kevent` ringbuffer, with the size given by the caller
> +of :c:func:`v4l2_event_subscribe`. Such ringbuffer is used to store any 
> events
> +raised by the driver.
> +
> +So every ``(type, ID)`` event tuple will have its own set of
> +:c:type:`v4l2_kevent` ringbuffer. This guarantees that if a driver is
> +generating lots of events of one type in a short time, then that will
> +not overwrite events of another type.
> +
> +But if you get more events of one type than the size of the
> +:c:type:`v4l2_kevent` ringbuffer, then the oldest event will be dropped
> +and the new one added.
> +
> +The :c:type:`v4l2_kevent` struct links into the ``available``
> +list of the :c:type:`v4l2_fh` struct so :ref:`VIDIOC_DQEVENT` will
> +know which event to dequeue first.
> +
> +Finally, if the event subscription is associated with a particular object
> +such as a V4L2 control, then that object needs to know about that as well
> +so that an event can be raised by that object. So the ``node`` field can
> +be used to link the :c:type:`v4l2_subscribed_event` struct into a list of
> +such object.
> +
> +So to summarize:
> +
> +- struct :c:type:`v4l2_fh` has two lists: one of the ``subscribed`` events,
> +  and one of the ``available`` events.
> +
> +- struct :c:type:`v4l2_subscribed_event` has a ringbuffer of raised
> +  (pending) events of that particular type.
> +
> +- If struct :c:type:`v4l2_subscribed_event` is associated with a specific
> +  object, then that object will have an internal list of
> +  struct :c:type:`v4l2_subscribed_event` so it knows who subscribed an
> +  event to that object.
>  
>  Furthermore, the internal struct :c:type:`v4l2_subscribed_event` has
>  ``merge()`` and ``replace()`` callbacks which drivers can set. These
>  callbacks are called when a new event is raised and there is no more room.
> +
>  The ``replace()`` callback allows you to replace the payload of the old event
>  with that of the new event, merging any relevant data from the old payload
>  into the new payload that replaces it. It is called when this event type has
> -only one kevent struct allocated. The ``merge()`` callback allows you to 
> merge
> -the oldest event payload into that of the second-oldest event payload. It is
> -called when there are two or more kevent structs allocated.
> +only one :c:type:`v4l2_kevent` struct allocated.
> +
> +The ``merge()`` callback 

Re: [PATCH v2 12/17] media: v4l2-fwnode.h: better describe bus union at fwnode endpoint struct

2017-09-28 Thread Sakari Ailus
Hi Mauro,

Thanks for the patch.

On Wed, Sep 27, 2017 at 06:46:55PM -0300, Mauro Carvalho Chehab wrote:
> Now that kernel-doc handles nested unions, better document the
> bus union at struct v4l2_fwnode_endpoint.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  include/media/v4l2-fwnode.h | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
> index 7adec9851d9e..5f4716f967d0 100644
> --- a/include/media/v4l2-fwnode.h
> +++ b/include/media/v4l2-fwnode.h
> @@ -79,7 +79,18 @@ struct v4l2_fwnode_bus_mipi_csi1 {
>   * struct v4l2_fwnode_endpoint - the endpoint data structure
>   * @base: fwnode endpoint of the v4l2_fwnode
>   * @bus_type: bus type
> - * @bus: bus configuration data structure
> + * @bus: union with bus configuration data structure
> + * @bus.parallel: pointer for  v4l2_fwnode_bus_parallel.
> + * Used if the bus is parallel.
> + * @bus.mipi_csi1: pointer for  v4l2_fwnode_bus_mipi_csi1.
> + *  Used if the bus is Mobile Industry Processor

s/Mobile.*Interface/MIPI Alliance/

Same below.

Please see:



With that,

Acked-by: Sakari Ailus 

> + *  Interface's Camera Serial Interface version 1
> + *  (MIPI CSI1) or Standard Mobile Imaging Architecture's
> + *  Compact Camera Port 2 (SMIA CCP2).
> + * @bus.mipi_csi2: pointer for  v4l2_fwnode_bus_mipi_csi2.
> + *  Used if the bus is Mobile Industry Processor
> + *  Interface's Camera Serial Interface version 2
> + *  (MIPI CSI2).
>   * @link_frequencies: array of supported link frequencies
>   * @nr_of_link_frequencies: number of elements in link_frequenccies array
>   */

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net] ipv6: fix net.ipv6.conf.all interface DAD handlers

2017-09-28 Thread Erik Kline
On 28 September 2017 at 13:47, Erik Kline  wrote:
>> Erik, please review.
>
> I apologize for the delay. I see that you've already applied this, and
> it's mostly LGTM except I have one thing I'm not seeing clearly.
>
> The documentation accept_dad  now claims:
>
> DAD operation and mode on a given interface will be selected according
> to the maximum value of conf/{all,interface}/accept_dad.
>
> but I'm try to square this with my reading of the changes to
> addrconf_dad_begin().  I think setting all.accept_dad to 0 but
> ifname.accept_dad to non-0 still results in the short-circuit call to
> addrconf_dad_completed().
>
> Am I just not seeing (thinking) straight?

Upon further reflection, doesn't the whole premise of this change
means that it's no longer possible to selectively disable these
features if they are set on "all"?  Or are we saying that this mode is
only support with "default" enable + "ifname" disable?


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PATCH v2 13/17] media: v4l2-async: simplify v4l2_async_subdev structure

2017-09-28 Thread Sylwester Nawrocki
On 09/27/2017 11:46 PM, Mauro Carvalho Chehab wrote:
> The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
> struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
> match criteria requires just a device name.
> 
> So, it doesn't make sense to enclose those into structs,
> as the criteria can go directly into the union.
> 
> That makes easier to document it, as we don't need to document
> weird senseless structs.
> 
> At drivers, this makes even clearer about the match criteria.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Sylwester Nawrocki 
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html