Re: [PATCH] arm: fault.c: fix unhandled page fault message

2015-07-16 Thread Levente Kurusa
Hi,

- Original Message -
> On Wed, Jul 15, 2015 at 05:30:50PM +0200, Levente Kurusa wrote:
> > Even if the signal was handled using signal(2) the message
> > would be printed. Fix that by checking whether the signal
> > is handled.
> 
> Why?

One of the reasons is that arm64 prints the same message only when the signal
is unhandled.

The other is the message saying "unhandled". :-)

But, don't get me wrong, I found the 'problem' by having a quick glimpse at the 
code
(even though I have a testcase now...), so if you think this is right this way,
then so be it.

> 
> Even if the application handles the signal, the point of this debugging is
> to have the kernel report the reason for the fault.
> 
> Just because the application has installed a SIGSEGV handler to print some
> nice "oops" message, and to cleanly shut down (eg, like Xorg) doesn't mean
> we should hide this debugging.  In fact, as such handlers generally get in
> the way of getting a decent dump from the application, having the kernel
> report this information is even more valuable in this situation.

I agree, but I find this being controlled by a kernel config option _and_ a
parameter makes it harder to use. Maybe we could switch to the sysctl,
"debug.exception-trace" like some other architectures do? What do you think?

Thanks,
Levente

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


[PATCH] arm: fault.c: fix unhandled page fault message

2015-07-15 Thread Levente Kurusa
Even if the signal was handled using signal(2) the message
would be printed. Fix that by checking whether the signal
is handled.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mm/fault.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 0d629b8..bbf5d73 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -164,8 +164,9 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
struct siginfo si;
 
 #ifdef CONFIG_DEBUG_USER
-   if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
-   ((user_debug & UDBG_BUS)  && (sig == SIGBUS))) {
+   if user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
+((user_debug & UDBG_BUS)  && (sig == SIGBUS))) &&
+unhandled_signal(tsk, sig)) {
printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, 
code 0x%03x\n",
   tsk->comm, sig, addr, fsr);
show_pte(tsk->mm, addr);
-- 
2.4.3

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


Re: [PATCH] lib/kstrtox.c break if overflow is detected

2015-01-21 Thread Levente Kurusa
Hi,

On Wed, Jan 21, 2015 at 11:26:26AM -0800, Anshul Garg wrote:
> From: Anshul Garg 
> 
> 1. While converting string representation to integer
> break the loop if overflow is detected.
> 2. Clean kstrtoll function
> 
> Signed-off-by: Anshul Garg 
> ---
>  lib/kstrtox.c |   28 +---
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/kstrtox.c b/lib/kstrtox.c
> index ec8da78..8cbe5ca 100644
> --- a/lib/kstrtox.c
> +++ b/lib/kstrtox.c
> @@ -70,8 +70,10 @@ unsigned int _parse_integer(const char *s, unsigned int 
> base, unsigned long long
>* it in the max base we support (16)
>*/
>   if (unlikely(res & (~0ull << 60))) {
> - if (res > div_u64(ULLONG_MAX - val, base))
> + if (res > div_u64(ULLONG_MAX - val, base)) {
>   overflow = 1;
> + break;
> + }
>   }
>   res = res * base + val;
>   rv++;
> @@ -146,23 +148,19 @@ EXPORT_SYMBOL(kstrtoull);
>  int kstrtoll(const char *s, unsigned int base, long long *res)
>  {
>   unsigned long long tmp;
> - int rv;
> + int rv, sign = 1;
>  
>   if (s[0] == '-') {
> - rv = _kstrtoull(s + 1, base, &tmp);
> - if (rv < 0)
> - return rv;
> - if ((long long)(-tmp) >= 0)
> - return -ERANGE;
> - *res = -tmp;
> - } else {
> - rv = kstrtoull(s, base, &tmp);
> - if (rv < 0)
> - return rv;
> - if ((long long)tmp < 0)
> - return -ERANGE;
> - *res = tmp;
> + sign = -1;
> + s++;
>   }
> +
> + rv = kstrtoull(s, base, &tmp);
> + if (rv < 0)
> + return rv;
> + if ((long long)tmp < 0)
> + return -ERANGE;
> + *res = sign * tmp;
>   return 0;
>  }
>  EXPORT_SYMBOL(kstrtoll);

Looks correct to me, so:

Reviewed-by: Levente Kurusa 

But I believe the two hunks are completely unrelated to
eachother and hence should split into a patch series.

Could you please do that and resend? Or if Andrew is OK
with picking it up as is, then it's fine.

Thanks,
Levente.


signature.asc
Description: Digital signature


Re: [PATCH] dma: xilinx: Remove .owner field for driver

2014-08-13 Thread Levente Kurusa
2014-08-13 13:57 GMT+02:00 Michal Simek :
> There is no need to init .owner field.
>
> Based on the patch from Peter Griffin 
> "mmc: remove .owner field for drivers using module_platform_driver"
>
> This patch removes the superflous .owner field for drivers which
> use the module_platform_driver API, as this is overriden in
> platform_driver_register anyway."
>
> Signed-off-by: Michal Simek 

Reviewed-by: Levente Kurusa 

Cheers,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] edac: Remove fixmes in e7xxx_edac.c

2014-07-22 Thread Levente Kurusa
2014-07-22 19:40 GMT+02:00 Nick Krause :
> [...]
>
> Tony,
>
> What is the value of Page shift then ? If you can tell me it would be
> much easier for
> me to fix this.
> Cheers Nick

Nick,

Help is always welcome. However, what you are doing is effectively a
waste of time for you and for the maintainers as well, and hence cannot
be called help. You are writing emails that make absolutely no sense at all.
If you want to help us out, please consider learning three things:

* The language that the kernel is written in: C
* The language that most kernel developers understand: English
* The environment the kernel is (in most cases) written in: UNIX

If you had known these, then:

* ... you would have already known that FIXMEs exist for a reason which is
   not at all simple.

* ... you would have understood that fixing FIXMEs without ANY reasoning and
   asking about it is completely useless and wastes precious maintainer time.

* ... you could have used grep for finding out PAGE_SHIFT and not need to ask
   for it.

Nick. Look, it is good that you are enthusiastic. However, this kind
of 'work' gives
you an undesirable reputation, which is {IF FROM:xerofoify@* THEN TRASH}...

If you really want to help out, I suggest you to find yourself a piece
of hardware from
the store and try to write a driver for it. That way, you will learn
how it all works, and if
you are intelligent enough then you might get a "Kernel Job - Payed"
like you asked us
for them in November.

Until then, please stop trying for FIXMEs. They will not get you a
commit in the kernel
99% of the time.

Hope you understand,

Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] davinci-vpfe: Fix retcode check

2014-07-08 Thread Levente Kurusa
2014-07-08 16:08 GMT+02:00 Andrey Utkin :
> Use signed type to check correctly for negative error code. The issue
> was reported with static analyser:
>
> [linux-3.13/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c:270]:
> (style) A pointer can not be negative so it is either pointless or an
> error to check if it is.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69071
> Reported-by: David Binderman 
> Signed-off-by: Andrey Utkin 

Hmm, while it is true that get_ipipe_mode returns an int, but
the consequent call to regw_ip takes an u32 as its second
argument. Did it cause a build warning for you? (Can't really
check since I don't have ARM cross compilers close-by)
If not, then:

Reviewed-by: Levente Kurusa 

Thanks,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Cleanup of Kernel Bugzilla

2014-06-29 Thread Levente Kurusa

Hi,

[Why was stable on Cc?]

On 06/29/2014 08:33 AM, Gideon D'souza wrote:

Why do you want an up to date list of kernel bugs?


Even I'm a newbie and was looking for the same thing. I read
eventually somewhere that bugzilla isn't maintained by kernel devs so
I entirely gave up trying to find a bug to adopt.

Many open source projects I've worked on (web frameworks mostly) have
a well maintained list of bugs and tag the right ones "newbie" or
"beginner suitable" and newbies can learn the ropes and get started
easy. Even chromium has a "GoodFirstBug" tag for newbies.


I think that is because they are relatively young and they are generally
used for one direct purpose. The kernel has to make sure it works in a lot
of different situations and hence a lot of different bugs arise.

The kernel is old, and hence most of the JuniorJobs (as KDE calls them)
are either already fixed, or fixed right on the spot when they are discovered.



With the linux kernel not only doesn't anything exist, the project
itself is so bloody hard right, kernel programming, most of the
bugzilla bugs I can barely understand let alone even begin to deduce
what is going on. Now given that the list itself isn't maintained
makes things extremely hard.


There are still methods to extract various unresolved bugs from the
bugzilla though. Look in any subsystem you find delicious and then
just sort the bugs by the date they were modified. This will yield
a list of nice fresh bugs along with some recently fixed bugs.



Thanks @Nick for bringing this up. I would love to help you clean up
the bugs, give me an email of any ideas you have on how to start.



I brought this up as well on the Kernel Summit list. There wasn't any
feedback on this :-), I guess there are some maintainers who care about
bugzilla, but the rest (and the majority probably) does not care.

I tend to think that even if we clean up the bugzilla, it will only be a
question of time until it gets to the state that it is in now.

Thanks,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv4]Checks for Null value in function *get_skub

2014-06-16 Thread Levente Kurusa

On 06/16/2014 05:37 PM, Nick Krause wrote:

Signed-off-by: Nicholas Krause 
---
  drivers/infiniband/hw/cxgb4/
cm.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index f9477e2..2d56983 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -340,15 +340,13 @@ static int status2errno(int status)
   */
  static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
  {
  if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) {
 skb_trim(skb, 0);
 skb_get(skb);
 skb_reset_transport_header(skb);
 } else {
+   if (skb)
/* NULL is ignored */.
+   kfree_skb (skb);
 skb = alloc_skb(len, gfp);
 }
 t4_set_arp_err_handler(skb, NULL, NULL);


This patch is severely whitespace damaged. Can you fix your MUA
or try to use git-send-email?

The changelog as well is of low quality. Maybe something like this:

infiniband: cxgb4: fix memory skb memory leak

... would be better.

Also, this fails the build, due to the extra dot character after
the comment. :-(

Thanks,
    Levente Kurusa.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv4]Checks for Null value in function *get_skub

2014-06-16 Thread Levente Kurusa

On 06/16/2014 05:30 PM, Steve Wise wrote:

On 6/16/2014 10:25 AM, Nicholas Krause wrote:

Signed-off-by: Nicholas Krause 
---
  drivers/infiniband/hw/cxgb4/cm.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index f9477e2..2d56983 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -340,15 +340,13 @@ static int status2errno(int status)
   */
  static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
  {
  if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) {
 skb_trim(skb, 0);
 skb_get(skb);
 skb_reset_transport_header(skb);
  } else {
+if (skb)
+kfree_skb (skb);
  skb = alloc_skb(len, gfp);
  }
  t4_set_arp_err_handler(skb, NULL, NULL);


Can you change the comment?  This patch is now fixing a potential skb leak.
Also, kfree_sb() will ignore NULL ptrs, so we could just always call it.

> But I'd add a comment like /* NULL is ignored */.

AFAIK, checkpatch.pl will show you a message if it detects this:

if (x)
kfree(x);

so I guess it is not really needed.

Thanks,
Levente Kurusa.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3]Checks for Null value in function *get_skub

2014-06-16 Thread Levente Kurusa

On 06/16/2014 05:08 PM, Nicholas Krause wrote:

Signed-off-by: Nicholas Krause 
---
  drivers/infiniband/hw/cxgb4/cm.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index f9477e2..2d56983 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -340,15 +340,13 @@ static int status2errno(int status)
   */
  static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
  {
  if (skb && !skb_is_nonlinear(skb) && !skb_cloned(skb)) {
 skb_trim(skb, 0);
 skb_get(skb);
 skb_reset_transport_header(skb);
} else {
+   if (skb)
+   kfree (skb);
skb = alloc_skb(len, gfp);
}
t4_set_arp_err_handler(skb, NULL, NULL);



Isn't kfree(NULL) legal?

(i.e. the if statement is useless)

Thanks,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: rtl8821ae: rtl8821ae: hw.c: Cleaning up if statement that always evaluates to false

2014-06-11 Thread Levente Kurusa
On Sun, Jun 08, 2014 at 01:37:43PM -0700, David Rientjes wrote:
> >  drivers/staging/rtl8821ae/rtl8821ae/hw.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.c 
> > b/drivers/staging/rtl8821ae/rtl8821ae/hw.c
> > index 1b8583b..52322e3 100644
> > --- a/drivers/staging/rtl8821ae/rtl8821ae/hw.c
> > +++ b/drivers/staging/rtl8821ae/rtl8821ae/hw.c
> > @@ -1623,7 +1623,7 @@ static int _rtl8821ae_set_media_status(struct 
> > ieee80211_hw *hw,
> >  
> > rtl_write_byte(rtlpriv, (MSR), bt_msr);
> > rtlpriv->cfg->ops->led_control(hw, ledaction);
> > -   if ((bt_msr & ~0xfc) == MSR_AP)
> > +   if ((bt_msr & MSR_AP) == MSR_AP)

I changed this line from '0xfc' to '~0xfc', and looking at the defines
it must have been the way your patch does, so:

Acked-by: Levente Kurusa 

if it wasn't applied yet, and you fix the problems David pointed out
with the commit message.

Thanks,
Levente Kurusa


signature.asc
Description: Digital signature


[PATCH] staging: rtl8821ae: fix pointer coding style

2014-05-10 Thread Levente Kurusa
Found by checkpatch.

Signed-off-by: Levente Kurusa 
---

 drivers/staging/rtl8821ae/pci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8821ae/pci.c b/drivers/staging/rtl8821ae/pci.c
index a562aa6..7bbaef7 100644
--- a/drivers/staging/rtl8821ae/pci.c
+++ b/drivers/staging/rtl8821ae/pci.c
@@ -392,7 +392,7 @@ static u8 _rtl_pci_get_pciehdr_offset(struct ieee80211_hw 
*hw)
 pcicfg_addr_port +
 (num4bytes << 2));
rtl_pci_raw_read_port_ushort(PCI_CONF_DATA,
-(u16*)&capability_hdr);
+(u16 *)&capability_hdr);
/* Found the PCI express capability. */
if (capability_hdr.capability_id ==
PCI_CAPABILITY_ID_PCI_EXPRESS)
-- 
1.7.9.5

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


[PATCH] libata: clean up ZPODD when a port is detached

2014-05-06 Thread Levente Kurusa
When a ZPODD device is unbound via sysfs, the ACPI notify handler
is not removed. This causes panics as observed in Bug #74601. The
panic only happens when the wake happens from outside the kernel
(i.e. inserting a media or pressing a button). Add a loop to
ata_port_detach which loops through the port's devices and checks
if zpodd is enabled, if so call zpodd_exit.

Cc: sta...@vger.kernel.org
Reviewed-by: Aaron Lu 
Signed-off-by: Levente Kurusa 
---
 drivers/ata/libata-core.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 943cc8b..ea83828 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6314,6 +6314,8 @@ int ata_host_activate(struct ata_host *host, int irq,
 static void ata_port_detach(struct ata_port *ap)
 {
unsigned long flags;
+   struct ata_link *link;
+   struct ata_device *dev;
 
if (!ap->ops->error_handler)
goto skip_eh;
@@ -6333,6 +6335,13 @@ static void ata_port_detach(struct ata_port *ap)
cancel_delayed_work_sync(&ap->hotplug_task);
 
  skip_eh:
+   /* clean up zpodd on port removal */
+   ata_for_each_link(link, ap, HOST_FIRST) {
+   ata_for_each_dev(dev, link, ALL) {
+   if (zpodd_dev_enabled(dev))
+   zpodd_exit(dev);
+   }
+   }
if (ap->pmp_link) {
int i;
for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
-- 
1.8.3.1

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


Re: [PATCH] ahci: unregister acpi notify handler when a ZPODD is unbound

2014-05-06 Thread Levente Kurusa
Hi,

On 05/06/2014 08:07 AM, Aaron Lu wrote:
> On 05/06/2014 02:02 PM, Levente Kurusa wrote:
>> Hi,
>>
>> On 05/06/2014 05:16 AM, Aaron Lu wrote:
>>> On 05/01/2014 12:04 AM, Levente Kurusa wrote:
>>>> When a ZPODD device is unbound via sysfs, the acpi notify handler
>>>> is not removed. This causes panics as observed in Bug #74601. The
>>>
>>> Ah...too bad, I forgot to consider this situation, thanks for tracking
>>> this.
>>>
>>>> panic only happens when the wake happens from outside the kernel
>>>> (i.e. inserting media or pressing a button). Implement a new
>>>> ahci_remove_one function which causes zpodd_exit to be called for all
>>>> ZPODD devices on the unbound PCI device.
>>>>
>>>> Signed-off-by: Levente Kurusa 
>>>> ---
>>>>
>>>> Hi,
>>>>
>>>> I am not sure if the loop below is correct. Maybe there is a better
>>>> solution to loop through all the devices which might use ZPODD?
>>>
>>> I didn't find a proper place either. For hotplug, we did the zpodd_exit
>>> at ata_scsi_handle_link_detach. But for host controller pci device
>>> removal, we used scsi_remove_host in ata_port_detach and there is no
>>> place to add the zpodd_exit for a to-be-removed scsi device...
>>>
>>> Looks like we can only iterate the ata devices and call zpodd_exit
>>> explicitly for them if they are zpodd devices. Instead of adding a new
>>> remove callback, what about just embed that into the ata_port_detach
>>> like the following example?
>>
>> Yes, this makes more sense as this doesn't tinker with exports and such...
>> However this will throw unused variable compiler warnings if we add the
>> required #ifdefs... Maybe a new function? ata_zpodd_detach_port?
> 
> I think we can omit the #ifdefs as the loop is not called frequently and
> thus doesn't cost much. We already have stubs for zpodd_dev_enabled and
> zpodd_exit.
> 

Ah, I see. Shall I send V2? Any tags I should add for you?

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] ahci: unregister acpi notify handler when a ZPODD is unbound

2014-05-05 Thread Levente Kurusa
Hi,

On 05/06/2014 05:16 AM, Aaron Lu wrote:
> On 05/01/2014 12:04 AM, Levente Kurusa wrote:
>> When a ZPODD device is unbound via sysfs, the acpi notify handler
>> is not removed. This causes panics as observed in Bug #74601. The
> 
> Ah...too bad, I forgot to consider this situation, thanks for tracking
> this.
> 
>> panic only happens when the wake happens from outside the kernel
>> (i.e. inserting media or pressing a button). Implement a new
>> ahci_remove_one function which causes zpodd_exit to be called for all
>> ZPODD devices on the unbound PCI device.
>>
>> Signed-off-by: Levente Kurusa 
>> ---
>>
>> Hi,
>>
>> I am not sure if the loop below is correct. Maybe there is a better
>> solution to loop through all the devices which might use ZPODD?
> 
> I didn't find a proper place either. For hotplug, we did the zpodd_exit
> at ata_scsi_handle_link_detach. But for host controller pci device
> removal, we used scsi_remove_host in ata_port_detach and there is no
> place to add the zpodd_exit for a to-be-removed scsi device...
> 
> Looks like we can only iterate the ata devices and call zpodd_exit
> explicitly for them if they are zpodd devices. Instead of adding a new
> remove callback, what about just embed that into the ata_port_detach
> like the following example?

Yes, this makes more sense as this doesn't tinker with exports and such...
However this will throw unused variable compiler warnings if we add the
required #ifdefs... Maybe a new function? ata_zpodd_detach_port?

> 
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 943cc8b83e59..43652da6fea6 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -6314,6 +6314,8 @@ int ata_host_activate(struct ata_host *host, int irq,
>  static void ata_port_detach(struct ata_port *ap)
>  {
>   unsigned long flags;
> + struct ata_link *link;
> + struct ata_device *dev;
>  
>   if (!ap->ops->error_handler)
>   goto skip_eh;
> @@ -6333,6 +6335,13 @@ static void ata_port_detach(struct ata_port *ap)
>   cancel_delayed_work_sync(&ap->hotplug_task);
>  
>   skip_eh:
> + /* clean up zpodd related stuffs on port removal */
> + ata_for_each_link(link, ap, HOST_FIRST) {
> + ata_for_each_dev(dev, link, ALL) {
> + if (zpodd_dev_enabled(dev))
> + zpodd_exit(dev);
> + }
> + }
>   if (ap->pmp_link) {
>   int i;
>   for (i = 0; i < SATA_PMP_MAX_PORTS; i++)

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2 2/2] staging/rtl8192e: userspace ptr deref + incorrect declarations

2014-05-05 Thread Levente Kurusa
Hi,

On Mon, May 05, 2014 at 01:59:49AM +0200, Dominique van den Broeck wrote:
> 
> Good evening,
> 
> Forgive my mistakes, I sent only a few patches yet and I'm still learning.
> Nevertheless:

Not a problem at all, since that is what the challenge is for.

> 
> > What is that period in the commit message? And the semicolon?
> 
> Semicolons is what one use to ponctuate an enumerated list (at least
> in french). In fact, it was their primary use before computer era.
> 
> Is there something wrong with it ? I check all my patches with
> checkpatch.pl --strict before sending them and it didn't seem to
> complain...

Oh, I see now! Well I guess it's better to have a commit message
that says WHY the change is good and WHAT did it change, not just
a list of what you did.

i.e. in this case you could also inline the sparse warning or at least
a part of it.

> 
> > You should also be a bit more specific. Also, the Subject line is
> > very bad. Better go with something like this:
> > 
> > staging: rtl8192e: fix userspace pointer dereference
> 
> Right. I used the slash as a subpart of the tree. Didn't know what
> was the best for this situation.

That is good as well, I just prefer the latter one, but feel
free to use whichever you feel better. :-)

> 
> > And when you resend a patchset, please resend the full patchset.
> 
> I usually do but I've got an acceptation message for the first one
> (see below).
> 

In that case, that's good.

> > This is totally unneccessary.
> 
> Should at least have gone in the body below indeed.
> 
> > When you cite a commit please don't include the full hash, that is
> > non informational. Better put the first 7 characters of the hash and
> > the first line of the commit message as well in parantheses, like so:
> >
> > 5169af2 ("Staging: rtl8192e: Fix declaration of symbols")
> > (I even have a command for this in vim :-) )
> 
> I'm interested. I use vim too.
> 

I have this:
--%<---
function! GetGitCommit(commit)
exec ":.!git log --oneline --pretty=\"format:\\%h ('\\%s')\" ".a:commit." 
-1"
endfunction
-->%---

> > Are you sure that 1/2 was applied to the staging tree?
> > It's unlikely that 1/2 is applied while 2/2 is left alone.
> 
> As stated before, I received the common automatic mail from
> Greg KH regarding this one. So I'll now wait before I do a v3
> for this issue. If so, I'll resent the complete set if required.

No, if that was applied it's unneccessary to resend the full set.

> 
> > Oh, I am unable to find commit b5c8d48 in Linus' or staging-next.
> > In which tree is it?
> 
> It's linux-next. If I quote a commit, I should the tree as well,
> indeed. But since the v1 was performed partially for the Eudyptula
> Project and since it was a response to a modification request, 
> I though it was implicit.

No, the tree's name is not needed. In fact, I should have checked it
in linux-next, but I only checked Linus', and staging-next thinking,
since you said it was applied, it was applied to staging-next. :-)
> 
> > Could you please as well remove that empty line in the declarations?
> 
> I'll do.
> Cheers.

Regards,
Levente Kurusa


signature.asc
Description: Digital signature


Re: [PATCH v2 2/2] staging/rtl8192e: userspace ptr deref + incorrect declarations

2014-05-04 Thread Levente Kurusa
Hi,

On Sun, May 04, 2014 at 04:46:27PM +0200, Dominique van den Broeck wrote:
> . userspace pointer dereference ;
> 

What is that period in the commit message? And the semicolon?
You should also be a bit more specific. Also, the Subject line is
very bad. Better go with something like this:

staging: rtl8192e: fix userspace pointer dereference

And when you resend a patchset, please resend the full patchset.

> These issues have been fixed by a concurrent patch:
> . missing inclusions of needed header files (fixed by concurrent patch);
> . unrequired static function declaration (confusing another *.c file).

This is totally unneccessary.

> 
> Signed-off-by: Dominique van den Broeck 
> ---
> v1 : I submit this patch as a result for Task #16 of the Eudyptula Challenge.
> v2 : Resubmitted because of a conflit with commit 
> 5169af2309f42bb4cb0ebfefe6bf8bc888d4ce33 .
>  Successfully tested against commit 
> b5c8d48bf8f4273a9fe680bd834f991005c8ab59 .
>  I resubmit only the 2/2 one, since the 1/2 as already been accepted.
> 
>  Levente, still agree with you about numeric values that should be 
> changed into symbols.
>  This will form another future patch.

When you cite a commit please don't include the full hash, that is
non informational. Better put the first 7 characters of the hash and
the first line of the commit message as well in parantheses, like so:

5169af2 ("Staging: rtl8192e: Fix declaration of symbols")
(I even have a command for this in vim :-) )

Are you sure that 1/2 was applied to the staging tree?
It's unlikely that 1/2 is applied while 2/2 is left alone.

Oh, I am unable to find commit b5c8d48 in Linus' or staging-next.
In which tree is it?

> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
> b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> index 498995d..d87cdfa 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> @@ -1131,11 +1131,18 @@ static int r8192_wx_set_PromiscuousMode(struct 
> net_device *dev,
>   struct r8192_priv *priv = rtllib_priv(dev);
>   struct rtllib_device *ieee = priv->rtllib;
>  
> - u32 *info_buf = (u32 *)(wrqu->data.pointer);
> + u32 info_buf[3];

Could you please as well remove that empty line in the declarations?

>  
> - u32 oid = info_buf[0];
> - u32 bPromiscuousOn = info_buf[1];
> - u32 bFilterSourceStationFrame = info_buf[2];
> + u32 oid;
> + u32 bPromiscuousOn;
> + u32 bFilterSourceStationFrame;
> +
> + if (copy_from_user(info_buf, wrqu->data.pointer, sizeof(info_buf)))
> + return -EFAULT;
> +
> + oid = info_buf[0];
> + bPromiscuousOn = info_buf[1];
> + bFilterSourceStationFrame = info_buf[2];
>  
>   if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) {
>   ieee->IntelPromiscuousModeInfo.bPromiscuousOn =

--
Regards,
Levente Kurusa


signature.asc
Description: Digital signature


[PATCH] ahci: unregister acpi notify handler when a ZPODD is unbound

2014-04-30 Thread Levente Kurusa
When a ZPODD device is unbound via sysfs, the acpi notify handler
is not removed. This causes panics as observed in Bug #74601. The
panic only happens when the wake happens from outside the kernel
(i.e. inserting media or pressing a button). Implement a new
ahci_remove_one function which causes zpodd_exit to be called for all
ZPODD devices on the unbound PCI device.

Signed-off-by: Levente Kurusa 
---

Hi,

I am not sure if the loop below is correct. Maybe there is a better
solution to loop through all the devices which might use ZPODD?

Thanks, Lev.

 drivers/ata/ahci.c | 21 +
 drivers/ata/ahci.h |  4 
 drivers/ata/libata-zpodd.c |  1 +
 3 files changed, 26 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 5a0bf8e..6d92bc9 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -475,12 +475,33 @@ static const struct pci_device_id ahci_pci_tbl[] = {
{ } /* terminate list */
 };
 
+#ifdef CONFIG_SATA_ZPODD
+void ahci_remove_one(struct pci_dev *pdev)
+{
+   struct ata_host *host = pci_get_drvdata(pdev);
+   struct ata_link *link;
+   struct ata_device *dev;
+   int i;
+
+   for (i = 0; i < host->n_ports; i++)
+   ata_for_each_link(link, host->ports[i], HOST_FIRST)
+   ata_for_each_dev(dev, link, ALL)
+   if (dev->zpodd)
+   zpodd_exit(dev);
+
+   ata_pci_remove_one(pdev);
+}
+#endif
 
 static struct pci_driver ahci_pci_driver = {
.name   = DRV_NAME,
.id_table   = ahci_pci_tbl,
.probe  = ahci_init_one,
+#ifdef CONFIG_SATA_ZPODD
+   .remove = ahci_remove_one,
+#else
.remove = ata_pci_remove_one,
+#endif
 #ifdef CONFIG_PM
.suspend= ahci_pci_device_suspend,
.resume = ahci_pci_device_resume,
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 51af275..87e4e6d 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -383,6 +383,10 @@ void ahci_print_info(struct ata_host *host, const char 
*scc_s);
 int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis);
 void ahci_error_handler(struct ata_port *ap);
 
+#ifdef CONFIG_SATA_ZPODD
+extern void zpodd_exit(struct ata_device *dev);
+#endif /* CONFIG_SATA_ZPODD */
+
 static inline void __iomem *__ahci_port_base(struct ata_host *host,
 unsigned int port_no)
 {
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index f3a65a3..fe66949 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -281,3 +281,4 @@ void zpodd_exit(struct ata_device *dev)
kfree(dev->zpodd);
dev->zpodd = NULL;
 }
+EXPORT_SYMBOL_GPL(zpodd_exit);
-- 
1.8.3.1

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


Re: [PATCH 2/2] staging/rtl8192e: userspace ptr deref + incorrect declarations

2014-04-27 Thread Levente Kurusa
Hi,

On Sun, Apr 27, 2014 at 07:11:16PM +0200, Dominique van den Broeck wrote:
> . userspace pointer dereference ;
> . missing inclusions of needed header files ;
> . unrequired static function declaration (confusing another *.c file).
> 
> Signed-off-by: Dominique van den Broeck 
> ---
> I submit this patch as a result for Task #16 of the Eudyptula Challenge.
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c 
> b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> index 498995d..d87cdfa 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> @@ -17,8 +17,10 @@
>   * wlanfae 
>  
> **/
>  
> +#include 
>  #include 
>  #include "rtl_core.h"
> +#include "rtl_wx.h"
>  
>  #define RATE_COUNT 12
>  static u32 rtl8192_rates[] = {
> @@ -1130,11 +1132,18 @@ static int r8192_wx_set_PromiscuousMode(struct 
> net_device *dev,
>   struct r8192_priv *priv = rtllib_priv(dev);
>   struct rtllib_device *ieee = priv->rtllib;
>  
> - u32 *info_buf = (u32 *)(wrqu->data.pointer);
> + u32 info_buf[3];
>  
> - u32 oid = info_buf[0];
> - u32 bPromiscuousOn = info_buf[1];
> - u32 bFilterSourceStationFrame = info_buf[2];
> + u32 oid;
> + u32 bPromiscuousOn;
> + u32 bFilterSourceStationFrame;
> +
> + if (copy_from_user(info_buf, wrqu->data.pointer, sizeof(info_buf)))
> + return -EFAULT;
> +
> + oid = info_buf[0];
> + bPromiscuousOn = info_buf[1];
> + bFilterSourceStationFrame = info_buf[2];

I guess it would be better to have defines for those instead of
hard-coding the offsets. Also the size of the info_buf array
might change depending on the size of wrqu->data.pointer, right?
Maybe create a new define for that as well?

Let's just be safe and create new defines to prevent headaches in
the future, if not for futher expansion then for the sake of
legibility.

Thanks,
Levente Kurusa


signature.asc
Description: Digital signature


Re: [PATCH] Staging: octeon-usb: fixed a macro coding style issue

2014-04-25 Thread Levente Kurusa
Hi,

On 04/25/2014 03:40 PM, Nicolas Del Piano wrote:
> Fixed a coding style error, macros with comples values should be enclosed in 
> parenthesis.
> 
> Signed-off-by: Nicolas Del Piano 
> ---
>  drivers/staging/octeon-usb/octeon-hcd.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
> b/drivers/staging/octeon-usb/octeon-hcd.c
> index 8b8ce72..475ecc4 100644
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ b/drivers/staging/octeon-usb/octeon-hcd.c
> @@ -246,7 +246,7 @@ enum cvmx_usb_pipe_flags {
>  };
> 
>  /* Normal prefetch that use the pref instruction. */
> -#define CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], 
> %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" 
> (0))
> +#define (CVMX_PREFETCH(address, offset) asm volatile ("pref %[type], 
> %[off](%[rbase])" : : [rbase] "d" (address), [off] "I" (offset), [type] "n" 
> (0)))

Not that way around! :-)

The parantheses should be around the code block not the
name block.

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-13 Thread Levente Kurusa
Hi,

2014-04-08 19:29 GMT+02:00 Levente Kurusa :
> Hi,
>
> On 04/08/2014 07:20 PM, Jason Cooper wrote:
>> On Tue, Apr 08, 2014 at 05:42:00PM +0200, Levente Kurusa wrote:
>>> On 04/07/2014 05:20 PM, Jason Cooper wrote:
>>>> On Sat, Apr 05, 2014 at 11:11:02AM +0200, Levente Kurusa wrote:
>>>>> Oh and another suggestion, I think placing it in the bottom-right
>>>>> corner would be better since then we wouldn't overwrite some of
>>>>> the timestamps and messages.
>>>>
>>>> The real text is still sent to the (hopefully written to disk) logs.  If
>>>> a user (or distro) builds with this feature, I would think centered and
>>>> scaled for ease of scanning would be highest priority.
>>>
>>> Yup, I'll be traveling on the train a lot this week, so I'll
>>> have plenty of time to implement scaling and centering. Maybe
>>> we could also implement this:
>>>
>>> qr_oops=center   (center the QR code with scale 1)
>>> qr_oops=center,3 (center the QR code with scale 3)
>>>
>>> 'center' could also be 'topleft', 'bottomright', etc.
>>> Or just remain at the KISS rule? (keep it simple)
>>>
>>> Any objections?
>>
>> KISS. ;-)
>>
>> Iff we find we need the feature later, we can always add qr_oops_pos or
>> similar.
>>
>
> Alright, I'll start the work on that tomorrow.
>
> Maybe I'll also find some time to clean up the library,
> since I guess that should be our primary priority.

Just a quick reminder that scaling was just merged in [0].
I'd highly appreciate feedback. Thanks!

Now that rendering is a bit cleaner I'll start cleaning up
the library. This is what I intend to do next week:

* Extract bitstream.c into a new kernel library. No point
  in restricting this to QR only.

* Rework bitstream to propagate errors, to use a caller
  allocation scheme and remove the ugly OOPness.

* Fix up the QR library so that it propagates errors
  from the new bitstream code.

Any objections?

[0]: 
https://github.com/teobaluta/qr-linux-kernel/commit/70401a9918e0810e7b0784fa6e1bdc766df20352

--
Regards,
Levente Kurusa
PGP: 4EF5D641
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-08 Thread Levente Kurusa
Hi,

On 04/08/2014 07:20 PM, Jason Cooper wrote:
> On Tue, Apr 08, 2014 at 05:42:00PM +0200, Levente Kurusa wrote:
>> On 04/07/2014 05:20 PM, Jason Cooper wrote:
>>> On Sat, Apr 05, 2014 at 11:11:02AM +0200, Levente Kurusa wrote:
>>>> Oh and another suggestion, I think placing it in the bottom-right
>>>> corner would be better since then we wouldn't overwrite some of
>>>> the timestamps and messages.
>>>
>>> The real text is still sent to the (hopefully written to disk) logs.  If
>>> a user (or distro) builds with this feature, I would think centered and
>>> scaled for ease of scanning would be highest priority.
>>
>> Yup, I'll be traveling on the train a lot this week, so I'll
>> have plenty of time to implement scaling and centering. Maybe
>> we could also implement this:
>>
>> qr_oops=center   (center the QR code with scale 1)
>> qr_oops=center,3 (center the QR code with scale 3)
>>
>> 'center' could also be 'topleft', 'bottomright', etc.
>> Or just remain at the KISS rule? (keep it simple)
>>
>> Any objections?
> 
> KISS. ;-)
> 
> Iff we find we need the feature later, we can always add qr_oops_pos or
> similar.
> 

Alright, I'll start the work on that tomorrow.

Maybe I'll also find some time to clean up the library,
since I guess that should be our primary priority.

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-08 Thread Levente Kurusa
Hi,

On 04/07/2014 05:20 PM, Jason Cooper wrote:
> On Sat, Apr 05, 2014 at 11:11:02AM +0200, Levente Kurusa wrote:
>> Or, we could use core_param and simply have 'oops_qr' or
>> 'qr_oops'. In my humble opinion the latter sounds better.
> 
> Ack.  My original suggestion was focused on 0=disable, >0 is scale.  I
> literally pulled the name from my nether-regions.  :-)

Pushed to Teodora. Hopefully she will pull it soon.

> 
>> Oh and another suggestion, I think placing it in the bottom-right
>> corner would be better since then we wouldn't overwrite some of
>> the timestamps and messages.
> 
> The real text is still sent to the (hopefully written to disk) logs.  If
> a user (or distro) builds with this feature, I would think centered and
> scaled for ease of scanning would be highest priority.

Yup, I'll be traveling on the train a lot this week, so I'll
have plenty of time to implement scaling and centering. Maybe
we could also implement this:

qr_oops=center   (center the QR code with scale 1)
qr_oops=center,3 (center the QR code with scale 3)

'center' could also be 'topleft', 'bottomright', etc.
Or just remain at the KISS rule? (keep it simple)

Any objections?

> 
> I don't think there is a 'safe' part of the framebuffer real estate
> where the QR could be written for all scenarios.  Best to make it easy
> to scan.

Yea we also need to prevent it from happening on panics. Currently on
panics, (i.e. exit when init=/bin/sh) will cause half of the QR code
not rendered on screen due to some reason. It looks like it is due
to scrolling, but I am not sure then why doesn't happen when I
do 'echo c > /proc/sysrq-trigger' which as well causes a panic.

Any ideas why this happens?

-- 
Regards,
Levente Kurusa
PGP: 4EF5D641
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-05 Thread Levente Kurusa
Hi,

On 04/04/2014 11:42 PM, Teodora Băluţă wrote:
> On Fri, Apr 4, 2014 at 7:17 PM, Levente Kurusa  wrote:
>> Hi,
>>
>> On 04/04/2014 05:15 PM, Jason Cooper wrote:
>>> On Thu, Apr 03, 2014 at 01:57:04PM -0700, David Lang wrote:
>>>> On Tue, 1 Apr 2014, Jason Cooper wrote:
>>>>
>>>>>> Now I guess we need to think how to make it work without a
>>>>>> framebuffer. I already suggested using the ASCII characters,
>>>>>> but seeing the resolution of this QR code for example (147x147),
>>>>>> made me realize that we can't shuffle that into a 80x25 textmode
>>>>>> display. Any ideas how to fix that or should we just simply depend
>>>>>> on a framebuffer being present?
>>>>>
>>>>> I think depending on the framebuffer being present (via kconfig) is
>>>>> sane.  Folks running old systems know what they're in for, like missing
>>>>> shiny new features. ;-)
>>>>
>>>> First get it working and into acceptable form, but after that, take
>>>> a look at the various ASCII-art tools out there. While the display
>>>> may be limited to 80x25, that's not a hard requirement (and I'd
>>>> happily run systems with a smaller text console if this was an
>>>> option), and then you can look at the possibility of using
>>>> characters that represent more than one pixel per character. While
>>>> this may not be able to render everything perfectly, remember that
>>>> qr codes can include redundancy to correct for bad pixels, you may
>>>> be able to get something working.
>>
>> I am not sure depending on the error recovery is good practice.
>> We also have to take into account that scanners themselves also
>> create noise and may not be perfect. Better reserve the error
>> recovery for those details instead of messing the QR code with
>> characters...
> 
> You do have the option of error recovery for up to 30% recovery (H
> level), but that means the space you get for storing is smaller.
> 
>>
>>>
>>> I'm not sure this will work.  The screen space allocated to a single
>>> character isn't square.  However, the QR pixels are square.  I see a lot
>>> of fragile complexity ahead...
>>>
>>
>> ... not to mention this as well.
>>
>>
>> IMHO supporting textmode is just not worth the effort. Besides,
>> what would we gain from it? Supporting those devices without
>> a framebuffer? Do devices like that even exist anymore? In fact,
>> even to make this you need a screen, and AFAIK most screens come
>> with some kind of a framebuffer to drive them.
> 
> Guys, first things first is cleaning the library up. I haven't managed
> to do anything yet as I am working on my thesis (bachelor's degree,
> yay!). I will do some this weekend and that is removing the kanji mode
> support. So, Levente, pleaso do that parameter thing you mentioned.
> Merging that with the cleanup shouldn't be a problem. :-)

Awesome, good luck on your thesis, take your time, we are not
rushing. :-)

Yea, I began the work on the parameter and scaling but using
'oops.qr=' isn't easy to use in a file called 'print_oops.c'.
Reason is that KBUILD_MODNAME will become 'print_oops' and then
MODULE_PARAM_PREFIX will be 'print_oops.' (note the dot character)
and so the final parameter will be 'print_oops.qr'. I have solved
this with:

#undef MODULE_PARAM_PREFIX
#define MODULE_PARAM_PREFIX "oops."

but I think this is ugly and is a hack. The good solution
would be to change KBUILD_MODNAME to 'oops' but I am not sure
how to do that, since I have little to no knowledge (and
experience) in how kbuild works.

Or, we could use core_param and simply have 'oops_qr' or
'qr_oops'. In my humble opinion the latter sounds better.

Or, there is __setup as well and that could achieve 'oops.qr',
but that is for *very* core stuff and this is probably not *that*
core. :-)

So, yea, if anyone knows how to change KBUILD_MODNAME without
ugly hacks, I would be grateful to be informed.


> 
> I think writing the QR to the frame buffer is the way to do it for
> now. Doing a QR in text mode (as in displaying it, not as previously
> mentioned idea with the link base64 encoding &/ compression) would
> mean that for each square you get an ASCII character filling up your
> screen. To get an idea of how the QR looks on the frame buffer I've
> made a screenshot. That's the whole Oops message being encoded and
> compressed. [0]

I am

Re: [RFC] QR encoding for Oops messages

2014-04-04 Thread Levente Kurusa
Hi,

On 04/04/2014 05:15 PM, Jason Cooper wrote:
> On Thu, Apr 03, 2014 at 01:57:04PM -0700, David Lang wrote:
>> On Tue, 1 Apr 2014, Jason Cooper wrote:
>>
>>>> Now I guess we need to think how to make it work without a
>>>> framebuffer. I already suggested using the ASCII characters,
>>>> but seeing the resolution of this QR code for example (147x147),
>>>> made me realize that we can't shuffle that into a 80x25 textmode
>>>> display. Any ideas how to fix that or should we just simply depend
>>>> on a framebuffer being present?
>>>
>>> I think depending on the framebuffer being present (via kconfig) is
>>> sane.  Folks running old systems know what they're in for, like missing
>>> shiny new features. ;-)
>>
>> First get it working and into acceptable form, but after that, take
>> a look at the various ASCII-art tools out there. While the display
>> may be limited to 80x25, that's not a hard requirement (and I'd
>> happily run systems with a smaller text console if this was an
>> option), and then you can look at the possibility of using
>> characters that represent more than one pixel per character. While
>> this may not be able to render everything perfectly, remember that
>> qr codes can include redundancy to correct for bad pixels, you may
>> be able to get something working.

I am not sure depending on the error recovery is good practice.
We also have to take into account that scanners themselves also
create noise and may not be perfect. Better reserve the error
recovery for those details instead of messing the QR code with
characters...

> 
> I'm not sure this will work.  The screen space allocated to a single
> character isn't square.  However, the QR pixels are square.  I see a lot
> of fragile complexity ahead...
> 

... not to mention this as well.


IMHO supporting textmode is just not worth the effort. Besides,
what would we gain from it? Supporting those devices without
a framebuffer? Do devices like that even exist anymore? In fact,
even to make this you need a screen, and AFAIK most screens come
with some kind of a framebuffer to drive them.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-04 Thread Levente Kurusa
Hi,

On 04/04/2014 05:12 PM, Jason Cooper wrote:
> On Thu, Apr 03, 2014 at 10:21:39PM +0200, Levente Kurusa wrote:
> ...
>> Oh and I had an idea of adding a new kernel parameter, something
>> like 'qr_oops.*'. (Looking for a better name! :-) )
>> Basically, I thought of the following options so far:
>>
>> *  qr_oops.disable=1  - disable it
>> *  qr_oops.scale=600x600 - scale the qr code so its easier to read
>>with a phone. In my testing I had huge difficulties reading the
>>QR codes, but when scaled to be a bit bigger it worked magically.
>>This might not be so easy to implement this way, but with preset
>>values, i.e. 4x4 squares instead of a pixel, it could work.
> 
> oops.qr=0 - disabled
> oops.qr=3 - make each QR pixel 3x3 screen pixels.
> 
> I've found 3x3 works well for business cards and such.
> 

Yea this makes more sense. I'll go and implement this
right now and send the changes to Teodora once finished.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-04-03 Thread Levente Kurusa
Hi,

2014-04-01 23:07 GMT+02:00 Teodora Băluţă :
> On Tue, Apr 1, 2014 at 5:20 PM, Jason Cooper  wrote:
>> On Sun, Mar 30, 2014 at 12:17:17PM +0200, Levente Kurusa wrote:
>>> Hi all,
>>>
>>> (sorry for the late reply, looks like this mail has ran away from my 
>>> clients)
>
> same here.
>
>>>
>>> 2014-03-23 20:38 GMT+01:00 Jason Cooper :
>>> > All,
>>> >
>>> > On Sat, Mar 22, 2014 at 08:20:01PM +0200, Teodora Băluţă wrote:
>>> >> On Sat, Mar 22, 2014 at 7:09 PM, Levente Kurusa  wrote:
>>> >> > On 03/21/2014 02:28 PM, Jason Cooper wrote:
>>> > ...
>>> >> >> I would definitely like to see the QR output incorporated into a
>>> >> >> kernel.org url.  That would remove the need for installing another 
>>> >> >> app,
>>> >> >> and would ease bug reporting.
>>> >> >
>>> >> > I still struggle to understand how could that be done. We can encode 
>>> >> > the
>>> >> > QR code as ASCII. Okay, that's fine, however it is very long. Encoding
>>> >> > 'Unable to handle kernel paging request at 000f' gave a 449 
>>> >> > character
>>> >> > long sequence with very strange characters [0]. We should try to 
>>> >> > shorten
>>> >> > it, imho. Not sure how to do that though.
>>> >
>>> > The man page for qrencode says you can have up to 4000 characters in a
>>> > qrcode.  However, I've seen readers have trouble with a 2048bit ascii
>>> > armored PGP public key (3929 characters).
>>> >
>>> > I grabbed a random oops from oops.kernel.org, it weighed in at 1544
>>> > bytes, not too bad.  I then did:
>>> >
>>> > $ echo "https://oops.kernel.org/?qr=`cat oops.txt | gzip -9 | base64 
>>> > -wrap=0`" | wc -c
>>> > 993
>>>
>>> I did the same with another OOPS and it had 1953 characters. That's quite a 
>>> big
>>> a big difference! :-)
>>>
>>> I created a QR image from the URL then, and it was 147x147, which is
>>> pretty small.
>>> It took me quite a long time to make my phone recognize it, but it
>>> worked nicely.
>>>
>>> Result of work is in this directory:
>>>
>>> http://levex.fedorapeople.org/kernel/qr/
>>
>> nice!
>>
>>> > The benefit of a url is that any QR reader can automagically report an
>>> > oops.  While a specific app could parse the URL/oops locally if the
>>> > user desires.
>>> >
>>> >> it misses the point of having a QR code in the first place. The way I
>>> >> see it, having a QR decoder app installed that can do an offline
>>> >> decoding is a less greater effort than popping out a browser on the
>>> >> machine you're working on.
>>> >
>>> > I think you're selling the advantage of the QR code short.  Automated
>>> > reporting (via the url) is a _huge_ plus.  The app you conceive of could
>>> > still parse it in place if the user desires.
>>> >
>>> > My point for the URL isn't to use the internet/server to automate oops
>>> > parsing for the user.  Rather it's to make it easy to report oopses to
>>> > developers.  While still preserving the ability of your app to parse it
>>> > for the user.
>>>
>>> Ah I see now. oops.kernel.org/?qr= would simply parse the
>>> base64'd+gzip'd oops message and then report it.
>>
>> If you mean the server behind oops.k.o would parse it, then yes.  No
>> special app should be required other than a QR code scanner for the
>> usecase of reporting oopses to developers.

Yup, clear now.

>>
>>> Now I guess we need to think how to make it work without a
>>> framebuffer. I already suggested using the ASCII characters,
>>> but seeing the resolution of this QR code for example (147x147),
>>> made me realize that we can't shuffle that into a 80x25 textmode
>>> display. Any ideas how to fix that or should we just simply depend
>>> on a framebuffer being present?
>>
>> I think depending on the framebuffer being present (via kconfig) is
>> sane.  Folks running old systems know what they're in for, like missing
>> shiny new features. ;-)
>
> Ok, this may work. I agree that doing this with the help of the frame
>

[PATCH RESEND] tc: account for device_register() failure

2014-04-02 Thread Levente Kurusa
This patch makes the TURBOchannel driver bail out if the call
to device_register() failed.

Signed-off-by: Levente Kurusa 
---
Resending as per Maciej's request to proper list and
people.
---
 tc.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c
index a8aaf6a..6b3a038 100644
--- a/drivers/tc/tc.c
+++ b/drivers/tc/tc.c
@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)

tc_device_get_irq(tdev);

-   device_register(&tdev->dev);
+   if (device_register(&tdev->dev)) {
+   put_device(&tdev->dev);
+   goto out_err;
+   }
list_add_tail(&tdev->node, &tbus->devices);

 out_err:
@@ -148,7 +151,10 @@ static int __init tc_init(void)

INIT_LIST_HEAD(&tc_bus.devices);
dev_set_name(&tc_bus.dev, "tc");
-   device_register(&tc_bus.dev);
+   if (device_register(&tc_bus.dev)) {
+   put_device(&tc_bus.dev);
+   return 0;   
+   }

if (tc_bus.info.slot_size) {
unsigned int tc_clock = tc_get_speed(&tc_bus) / 10;

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


Re: [PATCH] tc: account for device_register() failure

2014-04-01 Thread Levente Kurusa
Hi,

2014-04-01 2:30 GMT+02:00 Maciej W. Rozycki :
> On Fri, 15 Nov 2013, Levente Kurusa wrote:
>
>> This patch makes the TURBOchannel driver bail out if the call
>> to device_register() failed.
>>
>> Signed-off-by: Levente Kurusa 
>
> Acked-by: Maciej W. Rozycki 
>
> This fixes some build warnings:
>
> drivers/tc/tc.c: In function 'tc_bus_add_devices':
> drivers/tc/tc.c:132: warning: ignoring return value of 'device_register',
> declared with attribute warn_unused_result
> drivers/tc/tc.c: In function 'tc_init':
> drivers/tc/tc.c:151: warning: ignoring return value of 'device_register',
> declared with attribute warn_unused_result
>
> Levente, thanks for your fix and apologies for the long RTT -- can you
> please resend your patch to  and Ralf so that
> it'll be pulled via the MIPS tree?  I'll post a follow-up update to fix
> some issues with `tc_init' that I noticed thanks to your change.

Sure, I will repost in a few hours, I just need to get home.
Thanks for the Ack!

> [...]

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-03-30 Thread Levente Kurusa
Hi all,

(sorry for the late reply, looks like this mail has ran away from my clients)

2014-03-23 20:38 GMT+01:00 Jason Cooper :
> All,
>
> On Sat, Mar 22, 2014 at 08:20:01PM +0200, Teodora Băluţă wrote:
>> On Sat, Mar 22, 2014 at 7:09 PM, Levente Kurusa  wrote:
>> > On 03/21/2014 02:28 PM, Jason Cooper wrote:
> ...
>> >> I would definitely like to see the QR output incorporated into a
>> >> kernel.org url.  That would remove the need for installing another app,
>> >> and would ease bug reporting.
>> >
>> > I still struggle to understand how could that be done. We can encode the
>> > QR code as ASCII. Okay, that's fine, however it is very long. Encoding
>> > 'Unable to handle kernel paging request at 000f' gave a 449 character
>> > long sequence with very strange characters [0]. We should try to shorten
>> > it, imho. Not sure how to do that though.
>
> The man page for qrencode says you can have up to 4000 characters in a
> qrcode.  However, I've seen readers have trouble with a 2048bit ascii
> armored PGP public key (3929 characters).
>
> I grabbed a random oops from oops.kernel.org, it weighed in at 1544
> bytes, not too bad.  I then did:
>
> $ echo "https://oops.kernel.org/?qr=`cat oops.txt | gzip -9 | base64 
> -wrap=0`" | wc -c
> 993

I did the same with another OOPS and it had 1953 characters. That's quite a big
a big difference! :-)

I created a QR image from the URL then, and it was 147x147, which is
pretty small.
It took me quite a long time to make my phone recognize it, but it
worked nicely.

Result of work is in this directory:

http://levex.fedorapeople.org/kernel/qr/


>
> The benefit of a url is that any QR reader can automagically report an
> oops.  While a specific app could parse the URL/oops locally if the
> user desires.
>
>> it misses the point of having a QR code in the first place. The way I
>> see it, having a QR decoder app installed that can do an offline
>> decoding is a less greater effort than popping out a browser on the
>> machine you're working on.
>
> I think you're selling the advantage of the QR code short.  Automated
> reporting (via the url) is a _huge_ plus.  The app you conceive of could
> still parse it in place if the user desires.
>
> My point for the URL isn't to use the internet/server to automate oops
> parsing for the user.  Rather it's to make it easy to report oopses to
> developers.  While still preserving the ability of your app to parse it
> for the user.

Ah I see now. oops.kernel.org/?qr= would simply parse the
base64'd+gzip'd oops message and then report it.

Now I guess we need to think how to make it work without a
framebuffer. I already suggested using the ASCII characters,
but seeing the resolution of this QR code for example (147x147),
made me realize that we can't shuffle that into a 80x25 textmode
display. Any ideas how to fix that or should we just simply depend
on a framebuffer being present?

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] initramfs: print error and shell out for unsupported content

2014-03-26 Thread Levente Kurusa
Hi,

2014-03-26 22:16 GMT+01:00 Alexander Holler :
> Am 22.03.2014 00:07, schrieb Alexander Holler:
>>
>> Am 21.03.2014 23:55, schrieb Andrew Morton:
>>
>>> On Fri, 21 Mar 2014 23:49:57 +0100 Alexander Holler
>>>  wrote:
>>>
>>>> Am 21.03.2014 22:03, schrieb Andrew Morton:
>>>>>
>>>>> On Thu, 20 Mar 2014 23:00:45 +0100 Alexander Holler
>>>>>  wrote:
>>>>>
>>>>>> The initramfs generation is broken for file and directory names which
>>>>>> contain
>>>>>> colons or spaces. Print an error and don't try to continue.
>>>>
>>>>
>>>>> It would be better to fix the it-doesnt-work-with-all-filenames bug.
>>>>> Any details on that?
>>>>
>>>>
>>>> IMHO not worth the time. The whole process which is curently used is
>>>> extremly fragile.
>>>>
>>>> E.g it's almost guaranteed to fail trying to include arbitrary filenames
>>>> as dependencies in a Makefile. Besides the one problem I've discoverd
>>>> with colons, there could be much more things happen, e.g. with filenames
>>>> which do include other special Makefile characters you all would have to
>>>> escape correctly.
>
>
> To be a bit more verbose, (gnu)make doesn't support quoted filenames. That
> means one has to escape all kind of characters which might have a special
> meaning for make. Not really doable. Furthermore escaped characters are not
> very well supported by make and are usable only by a few rules.
>
>
>>>> And the problem with spaces isn't as easy to fix as it first does look
>>>> like. I think it might be easier to write the whole stuff new instead of
>>>> trying to escape the spaces in various ways needed to end up correctly
>>>> in the cpio (it first goes through shell code and is then feeded as some
>>>> list to a C program).
>
>
> To be a bit more verbose here, the shell script
> (scripts/gen_initramfs_list.sh) identifes filenames based on the position in
> a string which is delimited by the usual (shell) whitespace. E.g. $1 =
> filename, $2 = mode, ...
> And this stuff is then feeded to usr/gen_init_cpio.c,which uses a similiar
> approach like
>
> sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) "s %o %d %d", name,
> target, ...
>
> which obviously fails for filenames with whitspace too.
>
> What I think might be reasonable is:
>
> - get rid of the dependency list in form of a include into the Makefile and
> just generate the cpio-archive every time make is called. Common initramfs
> sizes are about a few megabytes and with today machines such a cpio-archive
> is build in about a second,
>

I don't understand what kind of include would you want.

> - get rid of gen_initramfs_list.sh and rewrite gen_init_cpio.c such that it
> reads the filenames, modes and similiar itself (e.g. by using stat(2)).

This is walkable but probably not worth the effort. Besides, why would
anyone want to put spaces, colons and arbitrary characters to filenames
in the initramfs?

>
>
> But I don't have any motivation to do so. Sorry.
>
> Maybe Levente Kurusa is interested in doing so, he seems to have an interest
> in the topic as he was quiet fast to send an answer to my patch.

All I wonder now is why are you being so arrogant. You are not a 'remote
keyboard' as you had called yourself, since when you send a patch
you not only have to send it but communicate WHY maintainers
should take that patch, and if somebody has a comment
spotting an obvious mistake you shouldn't become angry.
It was only a simple typo and a suggestion. Nobody told you
to blindly accept my suggestion. Everybody can have opinions.
It's open-source, the community suggests you new changes,
it's normal, get used to it. Writing up this nonsense sentence
(I feel the irony) probably took more time than actually resending
the patch did.

Just my two cents.

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-03-23 Thread Levente Kurusa
Hi,

On 03/22/2014 07:29 PM, Levente Kurusa wrote:
> Hi,
> 
> On 03/22/2014 07:20 PM, Teodora Băluţă wrote:
>> On Sat, Mar 22, 2014 at 7:09 PM, Levente Kurusa  wrote:
>>> Hi,
>>>
>>> On 03/21/2014 02:28 PM, Jason Cooper wrote:
>>>> On Wed, Mar 19, 2014 at 10:38:30PM +0200, Teodora Băluţă wrote:
>>>>> On Wed, Mar 19, 2014 at 10:18 PM, Dave Jones  wrote:
>>>>>> On Mon, Mar 17, 2014 at 02:59:47PM -0700, Teodora Baluta wrote:
>>>>>>  > This feature encodes Oops messages into a QR barcode that is 
>>>>>> scannable by
>>>>>>  > any device with a camera.
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>> That's a ton of code we're adding into one of the most fragile parts of 
>>>>>> the kernel.
>>>>>>
>>>>>> A lot of what libqrencode does would seem to be superfluous to the 
>>>>>> requirements
>>>>>> here, as we don't output kernel oopses in kanji for eg, and won't care 
>>>>>> about
>>>>>> multiple versions of the qr spec.
>>>>>
>>>>> That's true. I didn't do that much cleanup in the library afraid of
>>>>> breaking something and focused that I get this done one way or
>>>>> another. Indeed, the library is userspace and is made to be versatile
>>>>> rather than small.
>>>>
>>>> Perhaps you could add libqr to the staging tree?  As long as it
>>>> compiles, it can go there.  Then you can focus on cleanups and bloat
>>>> removal.  In the process, you'll get a larger testing base because it
>>>> will be in mainline.
>>>
>>> Yea that is a better way. However, the current state of the code has
>>> several problems:
>>>
>>> * No good error handling (simply returns -1 on failure no matter what)
>>>I have began converting this to the ERR_PTR et al interface
>>>However, I have not yet done this fully due to the vast amount
>>>of work required to do so.
>>>This shouldn't be yet merged, but I shall send it as patches once
>>>it gets into the staging tree.
>>>
>>> * All memory allocations are GFP_ATOMIC for no reason.
>>>I have converted them to GFP_KERNEL since we can block safely.
>>>This could be merged to Teodora's branch. I can send her a pull
>>>request on GitHub if she wants so.
>>
>> Since we are talking about some kernel Oopses I thought that making
>> this GFP_ATOMIC ensures that we get memory allocation. I have
>> considered using GFP_KERNEL, but I am not very sure about that.
>> Probably somewhere deep inside I wanted to make it work even for
>> panics. :(
> 
> Yea that makes sense, realized that just after I sent the mail.
> However, since this is in lib/ other parts might want to be
> able to use it and for them GFP_KERNEL makes more sense.

In order to make libqr usable in other parts of the kernel,
we need to heavily restructure libqr. It seems to use a style
that was inherited from OOP. Since we are in C, I don't like it.
I think that the allocations for the structs (e.g. QRinput) should
be done by the caller. That way we could remove most of the
allocations from libqr, and the rest may use GFP_KERNEL if they
still exist after that cleanup. Any objections?

>>>
>>> [...] 
>>>
>>> * I had trouble getting QR output.
>>>Doing 'echo c > /proc/sysrq-trigger' triggered a crash,
>>>but it resulted in a recursive OOPS. This is a nullptr-deref
>>>and hence I think it may be related to the fact I was running
>>>it in textmode. :-)
>>>Or, it is due to the bugged error handling.
>>
>> The QR output is written to the frame buffer. That means you have to
>> get acces to a console. As I mentioned in the RFC, I am looking for an
>> alternative to using fb.h since that doesn't seem to work very well
>> atm.

Okay, I sent you a pull request that fixes a recursive OOPS when crashing
in textmode and no higher mode is available. Patch attached as well [0].

Also, have you check ASCII characters 219-223? Maybe they are usable?
Any ideas?

[0]:

%<-
From: Levente Kurusa 
Subject: [PATCH] qr: print_oops: don't try to print if there is no framebuffer

If the kernel boots in textmode, we would hit a null pointer derefernce
in compute_w(). Prevent this by actually checking the value of info.

Signed-off-by: Levente Kurusa 
---
 k

Re: [RFC] QR encoding for Oops messages

2014-03-22 Thread Levente Kurusa
Hi,

On 03/22/2014 07:20 PM, Teodora Băluţă wrote:
> On Sat, Mar 22, 2014 at 7:09 PM, Levente Kurusa  wrote:
>> Hi,
>>
>> On 03/21/2014 02:28 PM, Jason Cooper wrote:
>>> On Wed, Mar 19, 2014 at 10:38:30PM +0200, Teodora Băluţă wrote:
>>>> On Wed, Mar 19, 2014 at 10:18 PM, Dave Jones  wrote:
>>>>> On Mon, Mar 17, 2014 at 02:59:47PM -0700, Teodora Baluta wrote:
>>>>>  > This feature encodes Oops messages into a QR barcode that is scannable 
>>>>> by
>>>>>  > any device with a camera.
>>>>>
>>>>> [...]
>>>>>
>>>>> That's a ton of code we're adding into one of the most fragile parts of 
>>>>> the kernel.
>>>>>
>>>>> A lot of what libqrencode does would seem to be superfluous to the 
>>>>> requirements
>>>>> here, as we don't output kernel oopses in kanji for eg, and won't care 
>>>>> about
>>>>> multiple versions of the qr spec.
>>>>
>>>> That's true. I didn't do that much cleanup in the library afraid of
>>>> breaking something and focused that I get this done one way or
>>>> another. Indeed, the library is userspace and is made to be versatile
>>>> rather than small.
>>>
>>> Perhaps you could add libqr to the staging tree?  As long as it
>>> compiles, it can go there.  Then you can focus on cleanups and bloat
>>> removal.  In the process, you'll get a larger testing base because it
>>> will be in mainline.
>>
>> Yea that is a better way. However, the current state of the code has
>> several problems:
>>
>> * No good error handling (simply returns -1 on failure no matter what)
>>I have began converting this to the ERR_PTR et al interface
>>However, I have not yet done this fully due to the vast amount
>>of work required to do so.
>>This shouldn't be yet merged, but I shall send it as patches once
>>it gets into the staging tree.
>>
>> * All memory allocations are GFP_ATOMIC for no reason.
>>I have converted them to GFP_KERNEL since we can block safely.
>>This could be merged to Teodora's branch. I can send her a pull
>>request on GitHub if she wants so.
> 
> Since we are talking about some kernel Oopses I thought that making
> this GFP_ATOMIC ensures that we get memory allocation. I have
> considered using GFP_KERNEL, but I am not very sure about that.
> Probably somewhere deep inside I wanted to make it work even for
> panics. :(

Yea that makes sense, realized that just after I sent the mail.
However, since this is in lib/ other parts might want to be
able to use it and for them GFP_KERNEL makes more sense.

> 
>>
>> * Selecting QR_OOPS and QRLIB currently does not build due to
>>undefined references to zlib_deflate* functions.
>>This is due to QRLIB not selecting ZLIB_DEFLATE.
>>Fixed this as well. Can be merged to Teodora if she wants.
> 
> Hmm, that's odd. I thought I added a 'depends' in the menu. Please
> make a pull request and I'll merge it immediately.

Sent it, also attached the patch [0].

> 
>>
>> * I had trouble getting QR output.
>>Doing 'echo c > /proc/sysrq-trigger' triggered a crash,
>>but it resulted in a recursive OOPS. This is a nullptr-deref
>>and hence I think it may be related to the fact I was running
>>it in textmode. :-)
>>Or, it is due to the bugged error handling.
> 
> The QR output is written to the frame buffer. That means you have to
> get acces to a console. As I mentioned in the RFC, I am looking for an
> alternative to using fb.h since that doesn't seem to work very well
> atm.

Yea this issue is significant. There are some ASCII codes which might
work in textmode though. (219-223) Maybe it's worth a shot to try it out.

> 
>>
>>>
>>> You may be interested in objdiff [1] which I'm using for merging code
>>> into the staging tree [2].  It provides an automated way to determine
>>> that code cleanups didn't change the resultant object code.  You can see
>>> an example run here [3].
> 
> I'll take a look. Thanks!
> 
>>>
>>> I would definitely like to see the QR output incorporated into a
>>> kernel.org url.  That would remove the need for installing another app,
>>> and would ease bug reporting.
>>
>> I still struggle to understand how could that be done. We can encode the
>> QR code as ASCII. Okay, that's fine,

Re: [RFC] QR encoding for Oops messages

2014-03-22 Thread Levente Kurusa
Hi,

On 03/21/2014 02:28 PM, Jason Cooper wrote:
> On Wed, Mar 19, 2014 at 10:38:30PM +0200, Teodora Băluţă wrote:
>> On Wed, Mar 19, 2014 at 10:18 PM, Dave Jones  wrote:
>>> On Mon, Mar 17, 2014 at 02:59:47PM -0700, Teodora Baluta wrote:
>>>  > This feature encodes Oops messages into a QR barcode that is scannable by
>>>  > any device with a camera.
>>>
>>> [...]
>>>
>>> That's a ton of code we're adding into one of the most fragile parts of the 
>>> kernel.
>>>
>>> A lot of what libqrencode does would seem to be superfluous to the 
>>> requirements
>>> here, as we don't output kernel oopses in kanji for eg, and won't care about
>>> multiple versions of the qr spec.
>>
>> That's true. I didn't do that much cleanup in the library afraid of
>> breaking something and focused that I get this done one way or
>> another. Indeed, the library is userspace and is made to be versatile
>> rather than small.
> 
> Perhaps you could add libqr to the staging tree?  As long as it
> compiles, it can go there.  Then you can focus on cleanups and bloat
> removal.  In the process, you'll get a larger testing base because it
> will be in mainline.

Yea that is a better way. However, the current state of the code has
several problems:

* No good error handling (simply returns -1 on failure no matter what)
   I have began converting this to the ERR_PTR et al interface
   However, I have not yet done this fully due to the vast amount
   of work required to do so.
   This shouldn't be yet merged, but I shall send it as patches once
   it gets into the staging tree.

* All memory allocations are GFP_ATOMIC for no reason.
   I have converted them to GFP_KERNEL since we can block safely.
   This could be merged to Teodora's branch. I can send her a pull
   request on GitHub if she wants so.

* Selecting QR_OOPS and QRLIB currently does not build due to
   undefined references to zlib_deflate* functions.
   This is due to QRLIB not selecting ZLIB_DEFLATE.
   Fixed this as well. Can be merged to Teodora if she wants.

* I had trouble getting QR output.
   Doing 'echo c > /proc/sysrq-trigger' triggered a crash,
   but it resulted in a recursive OOPS. This is a nullptr-deref
   and hence I think it may be related to the fact I was running
   it in textmode. :-)
   Or, it is due to the bugged error handling.

> 
> You may be interested in objdiff [1] which I'm using for merging code
> into the staging tree [2].  It provides an automated way to determine
> that code cleanups didn't change the resultant object code.  You can see
> an example run here [3].
> 
> I would definitely like to see the QR output incorporated into a
> kernel.org url.  That would remove the need for installing another app,
> and would ease bug reporting.

I still struggle to understand how could that be done. We can encode the
QR code as ASCII. Okay, that's fine, however it is very long. Encoding
'Unable to handle kernel paging request at 000f' gave a 449 character
long sequence with very strange characters [0]. We should try to shorten
it, imho. Not sure how to do that though.

oops.kernel.org/?qr=CODE  would look cool though. :-)

> 
> Anyway, if you're interested, I'll be re-posting a patch for objdiff
> separately maybe today or this weekend.


[0]: http://paste.fedoraproject.org/87665/39550664/


-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] initramfs: print error and shell out for unsupported content

2014-03-20 Thread Levente Kurusa
Hi,

2014-03-20 22:35 GMT+01:00 Alexander Holler :
> The initramfs generation is broken for file and directory names which contain
> colons or spaces. Print an error and don't try to continue.
>
> Tests:
>
> cd linux
> make defconfig
> echo 'CONFIG_BLK_DEV_INITRD=y' >> .config
> echo 'CONFIG_INITRAMFS_ROOT_UID=0' >>.config
> echo 'CONFIG_INITRAMFS_ROOT_GID=0' >>.config
> echo 'CONFIG_INITRAMFS_COMPRESSION_NONE=y' >>.config
> echo 'CONFIG_INITRAMFS_SOURCE="/tmp/bugroot"' >>.config
>
> Problem with colons:
>
> mkdir -p /tmp/bugroot/a:b
> make -j4 bzImage # no error
> make bzImage # try again, oops
>
> Problem with spaces:
>
> mkdir -p /tmp/bugroot/a\ b
> make -j4 bzImage # no error
> zcat usr/initramfs_data.cpio.gz | cpio --extract --list # oops, no content
>
> Signed-off-by: Alexander Holler 
> ---
>  scripts/gen_initramfs_list.sh | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
> index 17fa901..aacf366 100644
> --- a/scripts/gen_initramfs_list.sh
> +++ b/scripts/gen_initramfs_list.sh
> @@ -171,6 +171,17 @@ dir_filelist() {
> ${dep_list}header "$1"
>
> srcdir=$(echo "$1" | sed -e 's://*:/:g')
> +
> +   # Files and directories with spaces and colons are unsupported.
> +   local unsupported=$(find "${srcdir}" -regex '.*\(:\| \).*')
> +   if [ ! -z "${unsupported}" ]; then
> +   printf "ERROR: Unable to handle files/directories with " >&2
> +   printf "unsupported characters.\nPlease use other ways " >&2

'Please use other ways to...'
(i.e. missing "to")

> +   printf "generate a cpio-archive.\nUnsupported files and " >&2
> +   printf "directories are:\n$unsupported\n" >&2
> +   exit 1
> +   fi
> +

I think it would be worthy to tell the user what kind of characters
are unsupported. For instance, tell them that 'spaces' are unsupported.


> dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
>
> # If $dirlist is only one line, then the directory is empty
> [...]

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-03-19 Thread Levente Kurusa
Hi,

2014-03-19 21:50 GMT+01:00 Teodora Băluţă :
> On Wed, Mar 19, 2014 at 10:28 PM, Levente Kurusa  wrote:
>> Hi,
>>
>> 2014-03-19 21:18 GMT+01:00 Dave Jones :
>>> On Mon, Mar 17, 2014 at 02:59:47PM -0700, Teodora Baluta wrote:
>>>  > This feature encodes Oops messages into a QR barcode that is scannable by
>>>  > any device with a camera.
>>>
>>>  ...
>>>
>>>  >  include/linux/print_oops.h |   11 +
>>>  >  include/linux/qrencode.h   |  546 +
>>>  >  kernel/Makefile|1 +
>>>  >  kernel/panic.c |5 +
>>>  >  kernel/print_oops.c|  173 +
>>>  >  kernel/printk/printk.c |9 +-
>>>  >  lib/Kconfig|5 +
>>>  >  lib/Kconfig.debug  |   11 +
>>>  >  lib/Makefile   |3 +
>>>  >  lib/qr/Makefile|6 +
>>>  >  lib/qr/bitstream.c |  233 ++
>>>  >  lib/qr/bitstream.h |   37 +
>>>  >  lib/qr/mask.c  |  320 
>>>  >  lib/qr/mask.h  |   39 +
>>>  >  lib/qr/mmask.c |  175 +
>>>  >  lib/qr/mmask.h |   36 +
>>>  >  lib/qr/mqrspec.c   |  259 +++
>>>  >  lib/qr/mqrspec.h   |  155 
>>>  >  lib/qr/qrencode.c  |  871 +
>>>  >  lib/qr/qrencode.h  |  546 +
>>>  >  lib/qr/qrinput.c   | 1834 
>>> 
>>>  >  lib/qr/qrinput.h   |  129 
>>>  >  lib/qr/qrspec.c|  543 +
>>>  >  lib/qr/qrspec.h|  178 +
>>>  >  lib/qr/rscode.c|  325 
>>>  >  lib/qr/rscode.h|   38 +
>>>  >  lib/qr/split.c |  331 
>>>  >  lib/qr/split.h |   44 ++
>>>  >  28 files changed, 6860 insertions(+), 3 deletions(-)
>>
>> This idea is certainly great.
>>
>> However, there are quite a few problems with the code in terms of code style 
>> and
>> other terms as well. I am not sure how could we help you make this code
>> appliable, but it would be great if you put up a branch somewhere. This way
>> I could send you a few commits that do some fixups.
>
> Wow, that'd be great! I have set up my clone of the kernel source up
> on gitlab [0] and github [1]. I will update the remote branch asap (I
> made some coding style fixups that aren't present on github/gitlab
> right now, only in a remote branch). Is this ok?

Yea, that's fine. Push your changes and send me a ping once you
are done. I will most likely send you a pull request on github though.

>
>>
>>>
>>> That's a ton of code we're adding into one of the most fragile parts of the 
>>> kernel.
>>
>> Indeed, this should get split up.
>>
>>>
>>> A lot of what libqrencode does would seem to be superfluous to the 
>>> requirements
>>> here, as we don't output kernel oopses in kanji for eg, and won't care about
>>> multiple versions of the qr spec.
>>>
>>> How much of this could we drop ?
>>
>> A lot, most likely.
>
> Indeed.
>
>>
>> Also, I wonder if we could do the same for panic()?
>> I hate it when I receive a panic and I have no idea what's the cause
>> since my display is filled up with the stack trace.
>
> Most likely panic is harder to do for reasons discussed in this thread here 
> [2].
>

Yes I see.

>
> [0] https://gitlab.com/teobaluta/opw
> [1] https://github.com/teobaluta/qr-linux-kernel
> [2] https://lwn.net/Articles/503677/
>
> Thanks,
> Teodora
>>
>> --
>> Regards,
>> Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] QR encoding for Oops messages

2014-03-19 Thread Levente Kurusa
Hi,

2014-03-19 21:18 GMT+01:00 Dave Jones :
> On Mon, Mar 17, 2014 at 02:59:47PM -0700, Teodora Baluta wrote:
>  > This feature encodes Oops messages into a QR barcode that is scannable by
>  > any device with a camera.
>
>  ...
>
>  >  include/linux/print_oops.h |   11 +
>  >  include/linux/qrencode.h   |  546 +
>  >  kernel/Makefile|1 +
>  >  kernel/panic.c |5 +
>  >  kernel/print_oops.c|  173 +
>  >  kernel/printk/printk.c |9 +-
>  >  lib/Kconfig|5 +
>  >  lib/Kconfig.debug  |   11 +
>  >  lib/Makefile   |3 +
>  >  lib/qr/Makefile|6 +
>  >  lib/qr/bitstream.c |  233 ++
>  >  lib/qr/bitstream.h |   37 +
>  >  lib/qr/mask.c  |  320 
>  >  lib/qr/mask.h  |   39 +
>  >  lib/qr/mmask.c |  175 +
>  >  lib/qr/mmask.h |   36 +
>  >  lib/qr/mqrspec.c   |  259 +++
>  >  lib/qr/mqrspec.h   |  155 
>  >  lib/qr/qrencode.c  |  871 +
>  >  lib/qr/qrencode.h  |  546 +
>  >  lib/qr/qrinput.c   | 1834 
> 
>  >  lib/qr/qrinput.h   |  129 
>  >  lib/qr/qrspec.c|  543 +
>  >  lib/qr/qrspec.h|  178 +
>  >  lib/qr/rscode.c|  325 
>  >  lib/qr/rscode.h|   38 +
>  >  lib/qr/split.c |  331 
>  >  lib/qr/split.h |   44 ++
>  >  28 files changed, 6860 insertions(+), 3 deletions(-)

This idea is certainly great.

However, there are quite a few problems with the code in terms of code style and
other terms as well. I am not sure how could we help you make this code
appliable, but it would be great if you put up a branch somewhere. This way
I could send you a few commits that do some fixups.

>
> That's a ton of code we're adding into one of the most fragile parts of the 
> kernel.

Indeed, this should get split up.

>
> A lot of what libqrencode does would seem to be superfluous to the 
> requirements
> here, as we don't output kernel oopses in kanji for eg, and won't care about
> multiple versions of the qr spec.
>
> How much of this could we drop ?

A lot, most likely.

Also, I wonder if we could do the same for panic()?
I hate it when I receive a panic and I have no idea what's the cause
since my display is filled up with the stack trace.

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] regmap: Ensure regmap_register_patch() is compatible with fast_io

2014-03-18 Thread Levente Kurusa
Hi Mark,

Just a single, mini-comment.


2014-03-18 13:02 GMT+01:00 Mark Brown :
> From: Mark Brown 
>
> With fast_io we use mutexes to lock the I/O operations so we would need
> to do GFP_ATOMIC allocations if we wanted to do allocations inside the
> lock as we do currently. Since it is unlikely that we will want to register
> a patch outside of init where concurrency shouldn't be an issue move the
> allocation of the patch data outside the lock.
>
> Reported-by: Takashi Iwai 
> Signed-off-by: Mark Brown 
> ---
>  drivers/base/regmap/regmap.c | 25 ++---
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index 554119535a64..2d7d55b3bedb 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -2396,6 +2396,9 @@ EXPORT_SYMBOL_GPL(regmap_async_complete);
>   * apply them immediately.  Typically this is used to apply
>   * corrections to be applied to the device defaults on startup, such
>   * as the updates some vendors provide to undocumented registers.
> + *
> + * The caller must ensure that this function cannot be called
> + * concurrently with either itself or regcache_sync().
>   */
>  int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
>   int num_regs)
> @@ -2408,6 +2411,17 @@ int regmap_register_patch(struct regmap *map, const 
> struct reg_default *regs,
> num_regs))
> return 0;
>
> +   p = krealloc(map->patch,
> +sizeof(struct reg_default) * (map->patch_regs + 
> num_regs),
> +GFP_KERNEL);
> +   if (p) {
> +   memcpy(p + map->patch_regs, regs, num_regs * sizeof(*regs));
> +   map->patch = p;
> +   map->patch_regs += num_regs;
> +   } else {
> +   return -ENOMEM;
> +   }
> +

I think that is not checkpatch-safe :-)

> [...]

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: comedi: fix memory leak

2014-03-14 Thread Levente Kurusa
On 03/15/2014 04:30 AM, Chase Southwood wrote:
>> On Friday, March 14, 2014 11:47 AM, Levente Kurusa  wrote:
> 
>> Call kfree() on bdev. The variable is otherwise leaked.
>>
>> Signed-off-by: Levente Kurusa 
>> [...]
>>
> 
> 
> Levente,
> 
> This change has already been made in staging-next (by me, actually :) ).  In
> order to avoid re-doing work which has already been done, please make sure to 
> base
> all of your patches off of linux-next (or for staging, staging-next).
> 
> Thanks,
> Chase
> 

Ah, yes I see now. I wonder how it didn't reach my tree.
Anyways, thanks for the heads up!

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: fix memory leak

2014-03-14 Thread Levente Kurusa
Call kfree() on bdev. The variable is otherwise leaked.

Signed-off-by: Levente Kurusa 
---
 drivers/staging/comedi/drivers/comedi_bond.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/comedi_bond.c 
b/drivers/staging/comedi/drivers/comedi_bond.c
index 51a59e5..406aedb 100644
--- a/drivers/staging/comedi/drivers/comedi_bond.c
+++ b/drivers/staging/comedi/drivers/comedi_bond.c
@@ -254,6 +254,7 @@ static int do_dev_config(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (!devs) {
dev_err(dev->class_dev,
"Could not allocate memory. Out of 
memory?\n");
+   kfree(bdev);
return -ENOMEM;
}
devpriv->devs = devs;
-- 
1.8.3.1

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


Re: [PATCH 1/1] Add documentation for proper usage and order of preference of calls to print diagnostic messages.

2014-03-04 Thread Levente Kurusa
Hi,

[+CC Rob]

2014-03-04 15:31 GMT+01:00 yogesh :
> This patch adds documentation that clarifies the use of various
> diagnostic printing messages. It shows the preference of subsystem_dbg
> calls to dev_dbg (whenever possible), as they first preferred format of
> logging debug messages.
> Signed-off-by: Yogesh Chaudhari 

Acked-by: Levente Kurusa 

> ---
>  Documentation/CodingStyle | 17 +
>  1 file changed, 17 insertions(+)
>
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index 7fe0546..083f738 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -662,6 +662,23 @@ and driver, and are tagged with the right level:  
> dev_err(), dev_warn(),
>  dev_info(), and so forth.  For messages that aren't associated with a
>  particular device,  defines pr_debug() and pr_info().
>
> +If the subsystem has its own diagnostic macros then they should be used
> +instead of dev_dbg calls.
> +e.g. If you are using network subsystem, use netdev_dbg;
> +if you are using V4L, use v4l_dbg etc.
> +This standardises the output format in every subsystem.
> +
> +Depending on your changes, the following order of precedence
> +applies to printing messages:
> +1. [subsystem]_dbg() is preferred when the subsystem has its own
> +diagnostic macros.
> +2. dev_dbg() is preferred when you have a generic struct device object.
> +3. pr_debug() should be used when 1 and 2 above are not applicable.
> +4. printk() should be avoided.
> +
> +Note: The above order applies to diagnostic calls of all log levels viz:
> +*_emerg, *_alert, *_crit, *_err, *_warn, *_notice, *_info and *_dbg.
> +
>  Coming up with good debugging messages can be quite a challenge; and once
>  you have them, they can be a huge help for remote troubleshooting.  Such
>  messages should be compiled out when the DEBUG symbol is not defined (that
> --
>
> Regards
> Yogesh
> [...]

A lot better, but please next time send it as a separate mail
with subject [PATCH v2] or something like that. Thanks!

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] Add documentation for proper usage and order of preference of calls to print diagnostic messages.

2014-03-04 Thread Levente Kurusa
Hi,

2014-03-04 12:48 GMT+01:00 yogesh :
> This patch adds documentation that clarifies the use of various diagnostic 
> printing messages. It shows the preference of subsystem_dbg calls to dev_dbg 
> (whenever possible), as the first preferred format of logging debug messages.

Please wrap your changelog at 80 characters a line.

> Signed-off-by: Yogesh Chaudhari 
> ---
>  Documentation/CodingStyle | 14 ++
>  1 file changed, 14 insertions(+)
>
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index 7fe0546..9e0de25 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -662,6 +662,20 @@ and driver, and are tagged with the right level:  
> dev_err(), dev_warn(),
>  dev_info(), and so forth.  For messages that aren't associated with a
>  particular device,  defines pr_debug() and pr_info().
>
> +If the subsystem has its own diagnostic macros then they should be used
> +instead of dev_dbg calls.
> +e.g. If you are using network subsystem, use netdev_dbg;
> +if you are using V4L, use v4l_dbg etc.
> +This standardises the output format in every subsystem.
> +
> +Depending on your changes, the following order of precedence
> +applies to printing messages:
> +1. [subsystem]_dbg() is preferred when you the

The 'you' is unnecessary and incorrect.

> +subsystem has its own diagnostic macros.
> +2. dev_dbg() is preferred when you have a generic struct device object.
> +3. pr_debug() is used when 1 and 2 above are not applicable.

I think it's better to say "should be used".

> +4. printk() should be avoided.
> +
>  Coming up with good debugging messages can be quite a challenge; and once
>  you have them, they can be a huge help for remote troubleshooting.  Such
>  messages should be compiled out when the DEBUG symbol is not defined (that

I think we should also mention *_warn, *_err etc not just *_dbg.

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch 1/1] Changes to scripts/checkpatch.pl for improving warning messages in case printk usage is detected in a patch

2014-03-04 Thread Levente Kurusa
Hi,

2014-03-04 11:54 GMT+01:00 yogesh :
> This patch modifies warning message when printk is used in a patch. It 
> mentions to use subsystem_dbg instead of netdev_dbg as the first preffered 
> format of logging debug messages.
Please wrap your changelog at 80 characters a line.
Also, prefered instead of preffered.

> Signed-off-by: Yogesh Chaudhari 

Other than that:
Acked-by: Levente Kurusa 

Thank you!
> [...]

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch

2014-03-02 Thread Levente Kurusa
Hi,

2014-03-02 16:40 GMT+01:00 Joe Perches :
> On Sun, 2014-03-02 at 16:20 +0100, Levente Kurusa wrote:
>> IMHO, this message is too big. The one we already have is nice and clean.
>> I would simply do: s/netdev/[subsystem]/ or something among the lines.
>
> maybe:
>
> "Prefer [subsystem eg: netdev]_$level2 then dev_$level2 then pr_$level to 
> printk(KERN_$orig ...\n"

Excellent, that looks the best and combines the best of two worlds.

>
> or reference the stackoverflow link
>

And what if that disappears? Might as well write this to
Documentation/CodingStyle
as I have previously mentioned. Yogesh, you want to do this or should I?

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch

2014-03-02 Thread Levente Kurusa
Hi,

[+CC LKML, Joe]
[Leaving full copy for LKML, Joe]

On 03/02/2014 04:29 PM, Yogesh Chaudhari wrote:
> On 2 March 2014 20:50, Levente Kurusa  wrote:
>> Hi,
>>
>> On 03/02/2014 04:01 PM, Yogesh Chaudhari wrote:
>>> Based on the discussion here:
>>> https://lkml.org/lkml/2014/3/2/17
>>>
>>> I would like to propose this patch to improve the warning message in
>>> checkpatch.pl.  Comments/Suggestions on possible improvements are
>>> welcome.
>>>
>>>
>>> =
>>>
>>> This patch modifies scripts/checkpatch.pl to give more detailed
>>> warning message in case printk is used in any patch.
>>>
>>> Signed-off-by: Yogesh Chaudhari 
>>> ---
>>>  scripts/checkpatch.pl | 5 -
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 464dcef..526f33aa 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -2799,7 +2799,10 @@ sub process {
>>>  my $level2 = $level;
>>>  $level2 = "dbg" if ($level eq "debug");
>>>  WARN("PREFER_PR_LEVEL",
>>> - "Prefer netdev_$level2(netdev, ... then
>>> dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
>>> $herecurr);
>>
>> Whoops, that's a word-wrap!
>> Try using git-format-patch+git-send-email to send the patch.
> Ack, my bad, I will make this change.
> 
>>
>>> + "Order of preference for printing debug messages:
>>> + 1. [subsystem]_$level2([subsystem]dev, ... eg
>>> netdev_$level2(netdev, ... for netdevice object
>>> + 2. dev_$level2(dev, ... for drivers with struct device
>>> + 3. pr_$level(...  to printk(KERN_$orig ...\n" . 
>>> $herecurr);
>>>  }
>>>
>>>  if ($line =~ /\bpr_warning\s*\(/) {
>>>
>>
>> IMHO, this message is too big. The one we already have is nice and clean.
>> I would simply do: s/netdev/[subsystem]/ or something among the lines.
> 
> Seems proper way to go about. I agree that this makes it a bit too
> long, however, I was wondering, if there is a detailed
> documentation/information file about checkpatch (or patching in
> general where a detailed message would be accurate). Particularly,
> where we can make a note of proper way of using such debug calls.

Yes there is. Documentation/CodingStyle#Chapter13 is where you should
do stuff like that.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch

2014-03-02 Thread Levente Kurusa
Hi,

On 03/02/2014 04:01 PM, Yogesh Chaudhari wrote:
> Based on the discussion here:
> https://lkml.org/lkml/2014/3/2/17
> 
> I would like to propose this patch to improve the warning message in
> checkpatch.pl.  Comments/Suggestions on possible improvements are
> welcome.
> 
> 
> =
> 
> This patch modifies scripts/checkpatch.pl to give more detailed
> warning message in case printk is used in any patch.
> 
> Signed-off-by: Yogesh Chaudhari 
> ---
>  scripts/checkpatch.pl | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 464dcef..526f33aa 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2799,7 +2799,10 @@ sub process {
>  my $level2 = $level;
>  $level2 = "dbg" if ($level eq "debug");
>  WARN("PREFER_PR_LEVEL",
> - "Prefer netdev_$level2(netdev, ... then
> dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
> $herecurr);

Whoops, that's a word-wrap!
Try using git-format-patch+git-send-email to send the patch.

> + "Order of preference for printing debug messages:
> + 1. [subsystem]_$level2([subsystem]dev, ... eg
> netdev_$level2(netdev, ... for netdevice object
> + 2. dev_$level2(dev, ... for drivers with struct device
> + 3. pr_$level(...  to printk(KERN_$orig ...\n" . $herecurr);
>  }
> 
>  if ($line =~ /\bpr_warning\s*\(/) {
> 

IMHO, this message is too big. The one we already have is nice and clean.
I would simply do: s/netdev/[subsystem]/ or something among the lines.


-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: How to get rid of IRQF_DISABLED for good?

2014-02-20 Thread Levente Kurusa
2014-02-20 18:44 GMT+01:00 Michael Opdenacker
:
> Hi,
>
> In spite of the patches I have been sending (and resending!) over the
> past months, there are still 118 occurrences of the idle IRQF_DISABLED
> flag in the kernel code. This corresponds to 31 patches which haven't
> been accepted yet.
>
> What would you advise to get rid of IRQF_DISABLED for good?
>
>   * Send a treewide patch removing the last occurrences in one shot,
> bypassing the regular maintainers? Who could take it?

Andrew Morton would take it to his -mm tree.
This, IMO, seems to be the best solution to circumvent unresponsive/uncaring
maintainers.

>   * Remove the definition of IRQF_DISABLED to force the individual
> maintainers (and out of tree drivers!) to update their code? It
> could be a way of seeing which code isn't maintained any more ;)

No, every single patch has to be 'bisectable' meaning that when you bisect
you should be able to build every single patch as is.

>   * Continue to resend the patches for a few more cycles, until the
> corresponding maintainers can no longer bear the discredit?

Maybe once more, if they don't reply, send it to Andrew Morton as well
and CC a few people who know your work is good so that they can ACK it.

Oh and maybe you could add an __attribute__((deprecated)) to it, but
I am not sure that's possible and/or correct.


--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: davinci_vpfe: fix error check

2014-02-15 Thread Levente Kurusa
The check would check the pointer, which is never less than 0.
According to the error message, the correct check would be
to check the return value of ipipe_mode. Check that instead.

Reported-by: David Binderman 
Signed-off-by: Levente Kurusa 
---
 drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c 
b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c
index 2d36b60..b2daf5e 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c
@@ -267,7 +267,7 @@ int config_ipipe_hw(struct vpfe_ipipe_device *ipipe)
}
 
ipipe_mode = get_ipipe_mode(ipipe);
-   if (ipipe < 0) {
+   if (ipipe_mode < 0) {
pr_err("Failed to get ipipe mode");
return -EINVAL;
}
-- 
1.8.3.1

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


Re: [PATCH] [RFC] staging: rtl8821ae: fix invalid bit mask on MSR_AP check

2014-02-15 Thread Levente Kurusa
On 02/15/2014 11:36 AM, Dan Carpenter wrote:
> On Sat, Feb 15, 2014 at 08:53:34AM +0100, Levente Kurusa wrote:
>> Thanks Dan, maybe you know some people who could test it?
>> RTLXX guys? Or maybe we can take the patch as is?
>> I cannot really think of any other solution other than removing
>> the other clause, but since that was written to the file,
>> there must have been some logic behind that. I am slightly
>> disappointed get_maintainer didn't really find anybody for
>> this patch...
> 
> This driver is going to be deleted in the next couple weeks and replaced
> with a re-written from scratch driver.
> 

Oh, I did not know that. Since this fix isn't that big, I think it won't
get into the next -rc, and hence might not hit Linus' tree before
the new driver gets into staging. I am not sure if it is worth applying
if that is the case.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: rts5208: fix always true condition

2014-02-15 Thread Levente Kurusa
ANDing anything with 0x1E and expecting it to be not 0x03 will always
be true. AND instead with 0x03, so that we check the last two bits,
which should be what was intended there.

Reported-by: David Binderman 
Signed-off-by: Levente Kurusa 
---
 drivers/staging/rts5208/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index c7c1f54..03548e5 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -3512,7 +3512,7 @@ RTY_SEND_CMD:
TRACE_RET(chip, STATUS_FAIL);
 
} else if (rsp_type == SD_RSP_TYPE_R0) {
-   if ((ptr[3] & 0x1E) != 0x03)
+   if ((ptr[3] & 0x03) != 0x03)
TRACE_RET(chip, STATUS_FAIL);
}
}
-- 
1.8.3.1

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


Re: [PATCH] [RFC] staging: rtl8821ae: fix invalid bit mask on MSR_AP check

2014-02-14 Thread Levente Kurusa
On 02/14/2014 11:00 PM, Dan Carpenter wrote:
> [...]
>>  Hi,
>>
>>  This might not be the real solution since it is also possible that
>>  the particular condition never really happens. I seek comments
>>  so that I can post the proper patch.
>>
> 
> I can't test it either but I think your fix is correct.
> 
> Reviewed-by: Dan Carpenter 
> [...]

Thanks Dan, maybe you know some people who could test it?
RTLXX guys? Or maybe we can take the patch as is?
I cannot really think of any other solution other than removing
the other clause, but since that was written to the file,
there must have been some logic behind that. I am slightly
disappointed get_maintainer didn't really find anybody for
this patch...

Greg, can you take it as is or you would need the RFC tag removed?
(ie, repost)
Maybe you know somebody who could test it as well?

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [RFC] staging: rtl8821ae: fix invalid bit mask on MSR_AP check

2014-02-14 Thread Levente Kurusa
Since MSR_AP is 0x3, ANDing it with 0xFC will never be true.
Add a NOT operation to 0xFC so that we will AND with the last
three bits which will result in a possibility that the condition
will succeed.

Signed-off-by: Levente Kurusa 
---
 Hi,

 This might not be the real solution since it is also possible that
 the particular condition never really happens. I seek comments
 so that I can post the proper patch.

 Thanks!
 
 drivers/staging/rtl8821ae/rtl8821ae/hw.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.c 
b/drivers/staging/rtl8821ae/rtl8821ae/hw.c
index 5ed7a11..f204b31 100644
--- a/drivers/staging/rtl8821ae/rtl8821ae/hw.c
+++ b/drivers/staging/rtl8821ae/rtl8821ae/hw.c
@@ -1622,7 +1622,7 @@ static int _rtl8821ae_set_media_status(struct 
ieee80211_hw *hw,
 
rtl_write_byte(rtlpriv, (MSR), bt_msr);
rtlpriv->cfg->ops->led_control(hw, ledaction);
-   if ((bt_msr & 0xfc) == MSR_AP)
+   if ((bt_msr & ~0xfc) == MSR_AP)
rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
else
rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
-- 
1.7.9.5

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


Re: [PATCH 3.11 229/233] ALSA: hda - hdmi: introduce patch_nvhdmi()

2014-02-07 Thread Levente Kurusa
Hi,

On 02/07/2014 12:47 PM, Luis Henriques wrote:
> 3.11.10.4 -stable review patch.  If anyone has any objections, please let me 
> know.
>  [...]
>  
> +static int patch_nvhdmi(struct hda_codec *codec)
> +{
> + struct hdmi_spec *spec;
> + int err;
> +
> + err = patch_generic_hdmi(codec);
> + if (err)
> + return err;
> +
> + spec = codec->spec;
> +
> + return 0;
> +}
> [...]

Is it just me or is it that the 'spec' variable has no use?

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] backlight: replace kfree with put_device

2014-02-07 Thread Levente Kurusa
As per the comments on device_register, we shouldn't call kfree()
right after a device_register() failure. Instead call put_device(),
which in turn will call bl_device_release resulting in a kfree to the
full structure.

Signed-off-by: Levente Kurusa 
---
 drivers/video/backlight/backlight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight/backlight.c 
b/drivers/video/backlight/backlight.c
index 5d0..20b276e 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -333,7 +333,7 @@ struct backlight_device *backlight_device_register(const 
char *name,
 
rc = device_register(&new_bd->dev);
if (rc) {
-   kfree(new_bd);
+   put_device(&new_bd->dev);
return ERR_PTR(rc);
}
 
-- 
1.8.3.1

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


Re: [PATCH v2] dma: Add Xilinx AXI Video Direct Memory Access Engine driver support

2014-01-22 Thread Levente Kurusa
Hello,

2014/1/22 Srikanth Thokala :
> This is the driver for the AXI Video Direct Memory Access (AXI
> VDMA) core, which is a soft Xilinx IP core that provides high-
> bandwidth direct memory access between memory and AXI4-Stream
> type video target peripherals. The core provides efficient two
> dimensional DMA operations with independent asynchronous read
> and write channel operation.
>
> This module works on Zynq (ARM Based SoC) and Microblaze platforms.
>
> Signed-off-by: Srikanth Thokala 
> ---

Another two remarks, after you fixed them ( or not :-) )
you can have my:

Reviewed-by: Levente Kurusa 

Oh, and next time please if you post a patch that fixes something I pointed out,
CC me as I had a hard time finding this patch, thanks. :-)

> NOTE:
> 1. Created a separate directory 'dma/xilinx' as Xilinx has two more
>DMA IPs and we are also planning to upstream these drivers soon.
> 2. Rebased on v3.13.0-rc8
>
> Changes in v2:
> - Removed DMA Test client module from the patchset as suggested
>   by Andy Shevchenko
> - Removed device-id DT property, as suggested by Arnd Bergmann
> - Properly documented DT bindings as suggested by Arnd Bergmann
> - Returning with error, if registration of DMA to node fails
> - Fixed typo errors
> - Used BIT() macro at applicable places
> - Added missing header file to the patchset
> - Changed copyright year to include 2014
> ---
>  .../devicetree/bindings/dma/xilinx/xilinx_vdma.txt |   75 +
>  drivers/dma/Kconfig|   14 +
>  drivers/dma/Makefile   |1 +
>  drivers/dma/xilinx/Makefile|1 +
>  drivers/dma/xilinx/xilinx_vdma.c   | 1486 
> 
>  include/linux/amba/xilinx_dma.h|   50 +
>  6 files changed, 1627 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt
>  create mode 100644 drivers/dma/xilinx/Makefile
>  create mode 100644 drivers/dma/xilinx/xilinx_vdma.c
>  create mode 100644 include/linux/amba/xilinx_dma.h
>
> diff --git a/Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt 
> b/Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt
> new file mode 100644
> index 000..ab8be1a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/xilinx/xilinx_vdma.txt
> @@ -0,0 +1,75 @@
> +Xilinx AXI VDMA engine, it does transfers between memory and video devices.
> +It can be configured to have one channel or two channels. If configured
> +as two channels, one is to transmit to the video device and another is
> +to receive from the video device.
> +
> +Required properties:
> +- compatible: Should be "xlnx,axi-vdma-1.00.a"
> +- #dma-cells: Should be <1>, see "dmas" property below
> +- reg: Should contain VDMA registers location and length.
> +- xlnx,num-fstores: Should be the number of framebuffers as configured in 
> h/w.
> +- dma-channel child node: Should have atleast one channel and can have upto
> +   two channels per device. This node specifies the properties of each
> +   DMA channel (see child node properties below).
> +
> +Optional properties:
> +- xlnx,include-sg: Tells whether configured for Scatter-mode in
> +   the hardware.
> [...]
> +
> +/**
> + * xilinx_vdma_is_running - Check if VDMA channel is running
> + * @chan: Driver specific VDMA channel
> + *
> + * Return: '1' if running, '0' if not.
> + */
> +static int xilinx_vdma_is_running(struct xilinx_vdma_chan *chan)
> +{
> +   return !(vdma_ctrl_read(chan, XILINX_VDMA_REG_DMASR) &
> +XILINX_VDMA_DMASR_HALTED) &&
> +   (vdma_ctrl_read(chan, XILINX_VDMA_REG_DMACR) &
> +XILINX_VDMA_DMACR_RUNSTOP);
> +}
> +
> +/**
> + * xilinx_vdma_is_idle - Check if VDMA channel is idle
> + * @chan: Driver specific VDMA channel
> + *
> + * Return: '1' if idle, '0' if not.
> + */
> +static int xilinx_vdma_is_idle(struct xilinx_vdma_chan *chan)
> +{
> +   return vdma_ctrl_read(chan, XILINX_VDMA_REG_DMASR) &
> +   XILINX_VDMA_DMASR_IDLE;
> +}
> +
> +/**
> + * xilinx_vdma_halt - Halt VDMA channel
> + * @chan: Driver specific VDMA channel
> + */
> +static void xilinx_vdma_halt(struct xilinx_vdma_chan *chan)
> +{
> +   int loop = XILINX_VDMA_LOOP_COUNT + 1;
> +
> +   vdma_ctrl_clr(chan, XILINX_VDMA_REG_DMACR, XILINX_VDMA_DMACR_RUNSTOP);
> +
> +   /* Wait for the hardware to halt */
> +   while (loop--)
> +   if (vdma_ctrl_read(chan, XILINX_VDMA_REG_DMASR) &
> +   XILINX_VDMA_DMASR_HALTED)
&g

Re: [PATCH V3 1/1] Drivers: hv: Implement the file copy service

2014-01-21 Thread Levente Kurusa
Hello,

On 01/21/2014 08:06 PM, K. Y. Srinivasan wrote:
> Implement the file copy service for Linux guests on Hyper-V. This permits the
> host to copy a file (over VMBUS) into the guest. This facility is part of
> "guest integration services" supported on the Windows platform.
> Here is a link that provides additional details on this functionality:
> 
> http://technet.microsoft.com/en-us/library/dn464282.aspx
> 
> In V1 version of the patch I have addressed comments from
> Olaf Hering  and Dan Carpenter 
> 
> In V2 version of this patch I did some minor cleanup (making some globals
> static). In this version of the patch I have addressed all of Olaf's
> most recent set of comments/concerns.
> 
> Signed-off-by: K. Y. Srinivasan 
> ---

Just a few comments.

> + /*
> +  * The  strings sent from the host are encoded in
> +  * in utf16; convert it to utf8 strings.
> +  * The host assures us that the utf16 strings will not exceed
> +  * the max lengths specified. We will however, reserve room
> +  * for the string terminating character - in the utf16s_utf8s()
> +  * function we limit the size of the buffer where the converted
> +  * string is placed to W_MAX_PATH -1 to gaurantee

s/gaurantee/guarantee

> +  * that the strings can be properly terminated!
> +  */
> +
> + switch (operation) {
> + case START_FILE_COPY:
> + memset(smsg_out, 0, sizeof(struct hv_start_fcopy));
> + smsg_out->hdr.operation = operation;
> + smsg_in = (struct hv_start_fcopy *)fcopy_transaction.fcopy_msg;
> +
> + utf16s_to_utf8s((wchar_t *)smsg_in->file_name, W_MAX_PATH,
> + UTF16_LITTLE_ENDIAN,
> + (__u8 *)smsg_out->file_name, W_MAX_PATH - 1);
> +
> + utf16s_to_utf8s((wchar_t *)smsg_in->path_name, W_MAX_PATH,
> + UTF16_LITTLE_ENDIAN,
> + (__u8 *)smsg_out->path_name, W_MAX_PATH - 1);
> +
> + smsg_out->copy_flags = smsg_in->copy_flags;
> + smsg_out->file_size = smsg_in->file_size;
> + break;
> +
> + default:
> + break;
> + }
> + up(&fcopy_transaction.read_sema);
> + return;
> +}
> +
> [...]
> +static ssize_t fcopy_read(struct file *file, char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + int ret;
> + void *src;
> + size_t copy_size;
> + int operation;
> +
> + /*
> +  * Wait until there is something to be read.
> +  */
> + ret = down_interruptible(&fcopy_transaction.read_sema);
> + if (ret)
> + return -EINTR;

I don't know, but since you use 'ret' only once and you don't
even read it after, you could just simply remove it and check
the return code of down_interruptible() directly
> +
> + operation = fcopy_transaction.fcopy_msg->operation;
> +
> + if (operation == START_FILE_COPY) {
> + src = &fcopy_transaction.message;
> + copy_size = sizeof(struct hv_start_fcopy);
> + if (count < copy_size)
> + return 0;
> + } else {
> + src = fcopy_transaction.fcopy_msg;
> + copy_size = sizeof(struct hv_do_fcopy);
> + if (count < copy_size)
> + return 0;
> + }
> + if (copy_to_user(buf, src, copy_size))
> + return -EFAULT;

...like you do here.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] dma: Add Xilinx AXI Video Direct Memory Access Engine driver support

2014-01-16 Thread Levente Kurusa
>dev;
> +
> + /* Request and map I/O memory */
> + io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + xdev->regs = devm_ioremap_resource(&pdev->dev, io);
> + if (IS_ERR(xdev->regs))
> + return PTR_ERR(xdev->regs);
> +
> + /* Retrieve the DMA engine properties from the device tree */
> + xdev->has_sg = of_property_read_bool(node, "xlnx,include-sg");
> +
> + err = of_property_read_u32(node, "xlnx,num-fstores", &num_frames);
> + if (err < 0) {
> + dev_err(xdev->dev, "missing xlnx,num-fstores property\n");
> + return err;
> + }
> +
> + of_property_read_u32(node, "xlnx,flush-fsync", &xdev->flush_on_fsync);
> +
> + /* Initialize the DMA engine */
> + xdev->common.dev = &pdev->dev;
> +
> + INIT_LIST_HEAD(&xdev->common.channels);
> + dma_cap_set(DMA_SLAVE, xdev->common.cap_mask);
> + dma_cap_set(DMA_PRIVATE, xdev->common.cap_mask);
> +
> + xdev->common.device_alloc_chan_resources =
> + xilinx_vdma_alloc_chan_resources;
> + xdev->common.device_free_chan_resources =
> + xilinx_vdma_free_chan_resources;
> + xdev->common.device_prep_slave_sg = xilinx_vdma_prep_slave_sg;
> + xdev->common.device_control = xilinx_vdma_device_control;
> + xdev->common.device_tx_status = xilinx_vdma_tx_status;
> + xdev->common.device_issue_pending = xilinx_vdma_issue_pending;
> +
> + platform_set_drvdata(pdev, xdev);
> +
> + /* Initialize the channels */
> + for_each_child_of_node(node, child) {
> + err = xilinx_vdma_chan_probe(xdev, child);
> + if (err < 0)
> + goto error;
> + }
> +
> + for (i = 0; i < XILINX_VDMA_MAX_CHANS_PER_DEVICE; i++) {
> + if (xdev->chan[i])
> + xdev->chan[i]->num_frms = num_frames;
> + }
> +
> + /* Register the DMA engine with the core */
> + dma_async_device_register(&xdev->common);
> +
> + err = of_dma_controller_register(node, of_dma_xilinx_xlate,
> +  &xdev->common);
> + if (err < 0)
> + dev_err(&pdev->dev, "Unable to register DMA to DT\n");

Shouldn't this return 'err'? Like when you can't register the DMA to the node,
you might want to bail out, don't you?

> +
> + return 0;
> +
> +error:
> + for (i = 0; i < XILINX_VDMA_MAX_CHANS_PER_DEVICE; i++) {
> + if (xdev->chan[i])
> + xilinx_vdma_chan_remove(xdev->chan[i]);
> + }
> +
> + return err;
> +}
> [...]
> +static int xilinx_vdmatest_add_slave_channels(struct dma_chan *tx_chan,
> + struct dma_chan *rx_chan)
> +{
> + struct xilinx_vdmatest_chan *tx_dtc, *rx_dtc;
> + unsigned int thread_count = 0;
> +
> + tx_dtc = kmalloc(sizeof(struct xilinx_vdmatest_chan), GFP_KERNEL);
> + if (!tx_dtc)
> + return -ENOMEM;
> +
> + rx_dtc = kmalloc(sizeof(struct xilinx_vdmatest_chan), GFP_KERNEL);
> + if (!rx_dtc)
> + return -ENOMEM;

That's a memory leak. You gotta kfree tx_dtc.
> [...]
> 


-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Staging: android: fix parentheses coding style issue in alarm-dev.c

2014-01-16 Thread Levente Kurusa
Hello,

On 01/16/2014 12:32 AM, Michał Kwiatkowski wrote:
> This is a patch to the alarm-dev.c file that removes parentheses which
> should not appear in return statement. This error was found by the
> checkpatch.pl tool.
> 
> Signed-off-by: Michał Kwiatkowski 
> [...]
> +++ b/drivers/staging/android/alarm-dev.c
> @@ -68,8 +68,8 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
>   */
>  static int is_wakeup(enum android_alarm_type type)
>  {
> - return (type == ANDROID_ALARM_RTC_WAKEUP ||
> - type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP);
> + return type == ANDROID_ALARM_RTC_WAKEUP ||
> +type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP;
>  }

This is the fourth patch that does the exact same, an other similar patch
was already applied, hence this one will not apply. Please base your patches
on -next or the staging.git tree.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Staging: android: fix parentheses coding style issue in alarm-dev.c

2014-01-14 Thread Levente Kurusa
Hello,

2014/1/14 Michał Kwiatkowski :
> From: Michal Kwiatkowski 
>
> This is a patch to the alarm-dev.c file that removes parentheses which
> should not appear in return statement. This error was found by the
> checkpatch.pl tool.
>
> Signed-off-by: Michał Kwiatkowski 
> --

This is like the third patch in this two week period that does the
exact same with more or less success, and I recall one getting applied
(I might be wrong). Anyway, this one finally looks good! :-)

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] AlarmDev: Changing is_wakeup() to be a function to pass checkpatch

2014-01-12 Thread Levente Kurusa
Hello,

2014/1/12 Joe :
> ---
>  drivers/staging/android/alarm-dev.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)

You are missing a commit message. Your subject as well looks a bit weird.

>
> diff --git a/drivers/staging/android/alarm-dev.c 
> b/drivers/staging/android/alarm-dev.c
> index 647694f..87f2a02 100644
> --- a/drivers/staging/android/alarm-dev.c
> +++ b/drivers/staging/android/alarm-dev.c
> @@ -66,13 +66,15 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
>   *
>   * Return: 1 if this is a wakeup alarm, otherwise 0
>   */
> -static int is_wakeup(enum android_alarm_type type)
> +static int is_wakeup(enum andriod_alarm_type type)

What is this? andriod? Did it compile?

>  {
> -   return (type == ANDROID_ALARM_RTC_WAKEUP ||
> -   type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP);
> +   if (type == ANDROID_ALARM_RTC_WAKEUP ||
> +   type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP)
> +   return 1;
> +   else
> +   return 0;

While this is correct, the better fix would be to remove the parentheses..

Also, I think a similar patch was already applied, not sure though.

> [...]

--
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [trivial] doc: cgroups: Fix typo in doc/cgroups

2013-12-21 Thread Levente Kurusa
Hi,

spotted one more typo.

On 12/21/2013 04:57 PM, Masanari Iida wrote:
> diff --git a/Documentation/cgroups/resource_counter.txt 
> b/Documentation/cgroups/resource_counter.txt
> index c4d99ed..52e1da1 100644
> --- a/Documentation/cgroups/resource_counter.txt
> +++ b/Documentation/cgroups/resource_counter.txt
> @@ -97,8 +97,8 @@ to work with it.
>   (struct res_counter *rc, struct res_counter *top,
>unsinged long val)
 ^^ should be unsigned.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 21/38] workqueue: add missing put_device call

2013-12-19 Thread Levente Kurusa
[+Cc Greg]

On 12/19/2013 04:34 PM, Tejun Heo wrote:
> Hello,
> 
> On Thu, Dec 19, 2013 at 10:31 AM, Levente Kurusa  wrote:
>> The reason I removed the kfree() was because the put_device() will decrement
>> wq_dev->dev's reference count to zero (it is set to one by device_register) 
>> and hence the
>> wq_device_release() will be called. Now, this effectively does the same the 
>> kfree() call
>> would have done but also driver core is notified.
> 
> Yeah, I know it does the same thing. It's just not the right way to do it.
> 
>> Also, if you take a look at the comment for the device_register() function, 
>> it explicitly
>> says NOT to kfree the struct device, but instead call put_device() and let 
>> the device's release()
>> function take care.
> 
> Greg, the API as described by the comment is really weird and
> unconventional. Failed calls are not supposed to have side effects
> which require explicit cleanup. Can we please update the comment?
> 

Yes, it was already discussed that it would be more sane to have
device_register() call put_device() if it would fail, but Greg
said that the API was designed so that no kfree()s happen in the core.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 21/38] workqueue: add missing put_device call

2013-12-19 Thread Levente Kurusa
On 12/19/2013 04:20 PM, Tejun Heo wrote:
> Umm... this doesn't look right.  You're basically converting the code
> to the following,
> 
>   x = kmalloc();
>   if (register(x) < 0)
>   put(x)
> 
> They're not symmetrical anymore.  register(), or any API call really,
> isn't supposed to have side effects which need explicit cleanup after
> a failure.  The fact that x is properly initialized even after
> register(x) failed is a coincidental implementation detail which
> shouldn't be depended upon.  Your patch is actively breaking the
> convention for no good reason.
> 
>  Nacked-by: Tejun Heo 
> 
>>From the patch title, I suppose you posted a bunch of patches towards
> this direction.  Please consider all of them nacked if they're doing
> the same thing.
> 
> Thanks.
> 

The reason I removed the kfree() was because the put_device() will decrement
wq_dev->dev's reference count to zero (it is set to one by device_register) and 
hence the
wq_device_release() will be called. Now, this effectively does the same the 
kfree() call
would have done but also driver core is notified.

Also, if you take a look at the comment for the device_register() function, it 
explicitly
says NOT to kfree the struct device, but instead call put_device() and let the 
device's release()
function take care.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/38] arm: mach-imx: add missing put_device calls

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-imx/devices/devices.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/devices/devices.c 
b/arch/arm/mach-imx/devices/devices.c
index 1b4366a..0b17c89 100644
--- a/arch/arm/mach-imx/devices/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -37,11 +37,14 @@ int __init mxc_device_init(void)
int ret;
 
ret = device_register(&mxc_aips_bus);
-   if (ret < 0)
+   if (ret < 0) {
+   put_device(&mxc_aips_bus);
goto done;
+   }
 
ret = device_register(&mxc_ahb_bus);
-
+   if(ret < 0)
+   put_device(&mxc_ahb_bus);
 done:
return ret;
 }
-- 
1.8.3.1

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


[PATCH 10/38] arm: exynos: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-exynos/common.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 61d2906..8b58829 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -407,7 +407,13 @@ early_initcall(exynos4_l2x0_cache_init);
 
 static int __init exynos_init(void)
 {
+   int rc = 0;
+
printk(KERN_INFO "EXYNOS: Initializing architecture\n");
 
-   return device_register(&exynos4_dev);
+   rc = device_register(&exynos4_dev);
+   if (rc)
+   put_device(&exynos4_dev);
+   
+   return rc;
 }
-- 
1.8.3.1

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


[PATCH 04/38] powerpc: kernel: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/powerpc/kernel/vio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index e7d0c88f..e8ed87e 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1494,6 +1494,7 @@ static int __init vio_bus_init(void)
if (err) {
printk(KERN_WARNING "%s: device_register returned %i\n",
__func__, err);
+   put_device(&vio_bus_device.dev);
return err;
}
 
-- 
1.8.3.1

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


[PATCH 02/38] powerpc: qe_lib: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/powerpc/sysdev/qe_lib/qe_ic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c 
b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index b2b87c3..2e15262 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -493,6 +493,7 @@ static int __init init_qe_ic_sysfs(void)
rc = device_register(&device_qe_ic);
if (rc) {
printk(KERN_ERR "Failed registering qe_ic sys device\n");
+   put_device(&device_qe_ic);
return -ENODEV;
}
return 0;
-- 
1.8.3.1

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


[PATCH 32/38] pcie: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Removed the kfree() as put_device will result in release_pcie_device being
called and hence the container of the device will be kfree'd.

Signed-off-by: Levente Kurusa 
---
 drivers/pci/pcie/portdrv_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 08d131f..80fb1f2 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -345,7 +345,7 @@ static int pcie_device_init(struct pci_dev *pdev, int 
service, int irq)
 
retval = device_register(device);
if (retval)
-   kfree(pcie);
+   put_device(device);
else
get_device(device);
return retval;
-- 
1.8.3.1

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


[PATCH 07/38] arm: locomo: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Also, rework error path to remove the out label by return -ENOMEM explicitly if
kzalloc fails.

Signed-off-by: Levente Kurusa 
---
 arch/arm/common/locomo.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index b55c362..e17d02c 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -224,10 +224,8 @@ locomo_init_one_child(struct locomo *lchip, struct 
locomo_dev_info *info)
int ret;
 
dev = kzalloc(sizeof(struct locomo_dev), GFP_KERNEL);
-   if (!dev) {
-   ret = -ENOMEM;
-   goto out;
-   }
+   if (!dev)
+   return -ENOMEM;
 
/*
 * If the parent device has a DMA mask associated with it,
@@ -256,8 +254,7 @@ locomo_init_one_child(struct locomo *lchip, struct 
locomo_dev_info *info)
 
ret = device_register(&dev->dev);
if (ret) {
- out:
-   kfree(dev);
+   put_device(&dev->dev);
}
return ret;
 }
-- 
1.8.3.1

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


[PATCH 05/38] sparc: kernel: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
The kfree() has been removed because put_device will set the underlying kref's
reference count to zero and hence vio_dev_release will get called resulting in
kfreeing the structure.

Signed-off-by: Levente Kurusa 
---
 arch/sparc/kernel/vio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 8647fcc..fb0088d 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -307,7 +307,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle 
*hp, u64 mp,
if (err) {
printk(KERN_ERR "VIO: Could not register device %s, err=%d\n",
   dev_name(&vdev->dev), err);
-   kfree(vdev);
+   put_device(&vdev->dev);
return NULL;
}
if (vdev->dp)
-- 
1.8.3.1

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


[PATCH 08/38] arm: mach-rpc: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-rpc/ecard.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index fcb1d59..1c5f7cb 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -961,8 +961,10 @@ static int __init ecard_probe(int slot, unsigned irq, 
card_type_t type)
slot_to_expcard[slot] = ec;
 
rc = device_register(&ec->dev);
-   if (rc)
+   if (rc) {
+   put_device(&ec->dev);
goto nodev;
+   }
 
return 0;
 
-- 
1.8.3.1

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


[PATCH 11/38] arm: mach-integrator: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Calling put_device on the failed device will allow lm_device_release to be
called which will kfree() the struct lm_device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-integrator/lm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c
index f52c7af..1199f38 100644
--- a/arch/arm/mach-integrator/lm.c
+++ b/arch/arm/mach-integrator/lm.c
@@ -89,8 +89,10 @@ int lm_device_register(struct lm_device *dev)
ret = request_resource(&iomem_resource, &dev->resource);
if (ret == 0) {
ret = device_register(&dev->dev);
-   if (ret)
+   if (ret) {
release_resource(&dev->resource);
+   put_device(&dev->dev);
+   }
}
return ret;
 }
-- 
1.8.3.1

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


[PATCH 13/38] arm: s390: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/s390/kernel/time.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 064c308..16c717f 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1351,8 +1351,10 @@ static int __init etr_register_port(struct device *dev)
int rc;
 
rc = device_register(dev);
-   if (rc)
+   if (rc) {
+   put_device(dev);
goto out;
+   }
for (attr = etr_port_attributes; *attr; attr++) {
rc = device_create_file(dev, *attr);
if (rc)
-- 
1.8.3.1

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


[PATCH 15/38] mips: txx9: 7segled: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Also, add a new tx_7segled_release function which will be called after the
put_device to ensure that device is kfree'd.

Signed-off-by: Levente Kurusa 
---
 arch/mips/txx9/generic/7segled.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c
index 4642f56..3caa548 100644
--- a/arch/mips/txx9/generic/7segled.c
+++ b/arch/mips/txx9/generic/7segled.c
@@ -83,6 +83,10 @@ static struct bus_type tx_7segled_subsys = {
.dev_name   = "7segled",
 };
 
+void tx_7segled_release(struct device *dev) {
+   kfree(dev);
+}
+
 static int __init tx_7segled_init_sysfs(void)
 {
int error, i;
@@ -103,11 +107,14 @@ static int __init tx_7segled_init_sysfs(void)
}
dev->id = i;
dev->bus = &tx_7segled_subsys;
+   dev->release = &tx_7segled_release;
error = device_register(dev);
-   if (!error) {
-   device_create_file(dev, &dev_attr_ascii);
-   device_create_file(dev, &dev_attr_raw);
+   if (error) {
+   put_device(dev);
+   return error;
}
+   device_create_file(dev, &dev_attr_ascii);
+   device_create_file(dev, &dev_attr_raw); 
}
return error;
 }
-- 
1.8.3.1

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


[PATCH 18/38] ia64: kernel: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Removed kfree() as put_device() will result in tiocx_bus_release called.

Signed-off-by: Levente Kurusa 
---
 arch/ia64/sn/kernel/tiocx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index e35f648..6f369cc 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -209,7 +209,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
r = device_register(&cx_dev->dev);
if (r) {
-   kfree(cx_dev);
+   put_device(&cx_dev->dev);
return r;
}
get_device(&cx_dev->dev);
-- 
1.8.3.1

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


[PATCH 17/38] parisc: kernel: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/parisc/kernel/drivers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index 14285ca..b97cc05 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -428,7 +428,7 @@ struct parisc_device * create_tree_node(char id, struct 
device *parent)
dev->dev.dma_mask = &dev->dma_mask;
dev->dev.coherent_dma_mask = dev->dma_mask;
if (device_register(&dev->dev)) {
-   kfree(dev);
+   put_device(&dev->dev);
return NULL;
}
 
-- 
1.8.3.1

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


[PATCH 16/38] mips: sgi-ip22: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Also, create a gio_bus_release() that calls kfree on the device argument to
properly kfree() the memory allocated for the device.

Signed-off-by: Levente Kurusa 
---
 arch/mips/sgi-ip22/ip22-gio.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index ab0e379..931da33 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -24,8 +24,13 @@ static struct {
{ .name = "SGI GR2/GR3", .id = 0x7f },
 };
 
+void gio_bus_release(struct device *dev) {
+   kfree(dev);
+}
+
 static struct device gio_bus = {
.init_name = "gio",
+   .release = &gio_bus_release,
 };
 
 /**
@@ -400,8 +405,10 @@ int __init ip22_gio_init(void)
int ret;
 
ret = device_register(&gio_bus);
-   if (ret)
+   if (ret) {
+   put_device(&gio_bus);
return ret;
+   }
 
ret = bus_register(&gio_bus_type);
if (!ret) {
-- 
1.8.3.1

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


[PATCH 20/38] net: iucv: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 net/iucv/af_iucv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 168aff5..0096206 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -2377,8 +2377,10 @@ static int afiucv_iucv_init(void)
af_iucv_dev->release = (void (*)(struct device *))kfree;
af_iucv_dev->driver = &af_iucv_driver;
err = device_register(af_iucv_dev);
-   if (err)
+   if (err) {
+   put_device(af_iucv_dev);
goto out_driver;
+   }
return 0;
 
 out_driver:
-- 
1.8.3.1

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


[PATCH 25/38] pnp: card: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/pnp/card.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index bc00693..874c236 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -239,6 +239,7 @@ int pnp_add_card(struct pnp_card *card)
error = device_register(&card->dev);
if (error) {
dev_err(&card->dev, "could not register (err=%d)\n", error);
+   put_device(&card->dev);
return error;
}
 
-- 
1.8.3.1

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


[PATCH 22/38] sound: ac97: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 sound/pci/ac97/ac97_codec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index bf578ba2..55186f8 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1964,6 +1964,7 @@ static int snd_ac97_dev_register(struct snd_device 
*device)
 snd_ac97_get_short_name(ac97));
if ((err = device_register(&ac97->dev)) < 0) {
snd_printk(KERN_ERR "Can't register ac97 bus\n");
+   put_device(&ac97->dev);
ac97->dev.bus = NULL;
return err;
}
-- 
1.8.3.1

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


[PATCH 23/38] sound: soc: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 sound/soc/soc-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4e53d87..21caa09 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -536,6 +536,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec 
*codec)
err = device_register(&codec->ac97->dev);
if (err < 0) {
dev_err(codec->dev, "ASoC: Can't register ac97 bus\n");
+   put_device(&codec->ac97->dev);
codec->ac97->dev.bus = NULL;
return err;
}
-- 
1.8.3.1

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


[PATCH 35/38] media: bt8xx: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Remove the kfree() because the put_device() call will actually call
release_sub_device which in turn kfrees the device.

Signed-off-by: Levente Kurusa 
---
 drivers/media/pci/bt8xx/bttv-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/bt8xx/bttv-gpio.c 
b/drivers/media/pci/bt8xx/bttv-gpio.c
index 922e823..3f364b7 100644
--- a/drivers/media/pci/bt8xx/bttv-gpio.c
+++ b/drivers/media/pci/bt8xx/bttv-gpio.c
@@ -98,7 +98,7 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
 
err = device_register(&sub->dev);
if (0 != err) {
-   kfree(sub);
+   put_device(&sub->dev);
return err;
}
pr_info("%d: add subdevice \"%s\"\n", core->nr, dev_name(&sub->dev));
-- 
1.8.3.1

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


[PATCH 37/38] uwb: umc-dev: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/uwb/umc-dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/uwb/umc-dev.c b/drivers/uwb/umc-dev.c
index 4613c13..7b0b268 100644
--- a/drivers/uwb/umc-dev.c
+++ b/drivers/uwb/umc-dev.c
@@ -66,6 +66,7 @@ int umc_device_register(struct umc_dev *umc)
return 0;
 
 error_device_register:
+   put_device(&umc->dev);
release_resource(&umc->resource);
 error_request_resource:
return err;
-- 
1.8.3.1

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


[PATCH 36/38] dio: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/dio/dio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 55dd88d..5d4d755 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -186,6 +186,7 @@ static int __init dio_init(void)
error = device_register(&dio_bus.dev);
if (error) {
pr_err("DIO: Error registering dio_bus\n");
+   put_device(&dio_bus.dev);
return error;
}
 
-- 
1.8.3.1

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


[PATCH 34/38] infiniband: core: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/infiniband/core/sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index faad2ca..bf279ce 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -824,8 +824,10 @@ int ib_device_register_sysfs(struct ib_device *device,
INIT_LIST_HEAD(&device->port_list);
 
ret = device_register(class_dev);
-   if (ret)
+   if (ret) {
+   put_device(class_dev);
goto err;
+   }
 
for (i = 0; i < ARRAY_SIZE(ib_class_attributes); ++i) {
ret = device_create_file(class_dev, ib_class_attributes[i]);
-- 
1.8.3.1

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


[PATCH 38/38] bcma: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/bcma/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index e15430a..5a9f6bd 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -176,6 +176,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
bcma_err(bus,
 "Could not register dev for core 0x%03X\n",
 core->id.id);
+   put_device(&core->dev);
continue;
}
core->dev_registered = true;
-- 
1.8.3.1

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


[PATCH 27/38] superhyway: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Also, this makes superhyway_device_release actually used.

Signed-off-by: Levente Kurusa 
---
 drivers/sh/superhyway/superhyway.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/sh/superhyway/superhyway.c 
b/drivers/sh/superhyway/superhyway.c
index 2d9e7f3..765cf7d 100644
--- a/drivers/sh/superhyway/superhyway.c
+++ b/drivers/sh/superhyway/superhyway.c
@@ -54,6 +54,7 @@ int superhyway_add_device(unsigned long base, struct 
superhyway_device *sdev,
  struct superhyway_bus *bus)
 {
struct superhyway_device *dev = sdev;
+   int rc = 0;
 
if (!dev) {
dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL);
@@ -86,8 +87,11 @@ int superhyway_add_device(unsigned long base, struct 
superhyway_device *sdev,
dev_set_name(&dev->dev, "%02x", superhyway_devices);
 
superhyway_devices++;
+   rc = device_register(&dev->dev);
+   if (rc)
+   put_device(&dev->dev);
 
-   return device_register(&dev->dev);
+   return rc;
 }
 
 int superhyway_add_devices(struct superhyway_bus *bus,
-- 
1.8.3.1

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


[PATCH 33/38] scsi: transport: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Remove the kfree() as well, because the put_device() will result in
iscsi_endpoint_release being called and hence it will be kfree'd.

Signed-off-by: Levente Kurusa 
---
 drivers/scsi/scsi_transport_iscsi.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 63a6ca4..ff20f35 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -219,8 +219,10 @@ iscsi_create_endpoint(int dd_size)
ep->dev.class = &iscsi_endpoint_class;
dev_set_name(&ep->dev, "ep-%llu", (unsigned long long) id);
err = device_register(&ep->dev);
-if (err)
-goto free_ep;
+if (err) {
+   put_device(&ep->dev);
+   return NULL;
+   }
 
err = sysfs_create_group(&ep->dev.kobj, &iscsi_endpoint_group);
if (err)
@@ -233,10 +235,6 @@ iscsi_create_endpoint(int dd_size)
 unregister_dev:
device_unregister(&ep->dev);
return NULL;
-
-free_ep:
-   kfree(ep);
-   return NULL;
 }
 EXPORT_SYMBOL_GPL(iscsi_create_endpoint);
 
-- 
1.8.3.1

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


[PATCH 21/38] workqueue: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Remove the kfree() as that is the job of wq_device_release which will now
be called due to the reference count actually reaching zero.

Signed-off-by: Levente Kurusa 
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 987293d..f3b3398 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3361,7 +3361,7 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
 
ret = device_register(&wq_dev->dev);
if (ret) {
-   kfree(wq_dev);
+   put_device(&wq_dev->dev);
wq->wq_dev = NULL;
return ret;
}
-- 
1.8.3.1

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


[PATCH 06/38] arm: mach-s3c64: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-s3c64xx/dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 7e22c21..090852d 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -663,6 +663,7 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
err = device_register(&dmac->dev);
if (err) {
printk(KERN_ERR "%s: failed to register device\n", __func__);
+   put_device(&dmac->dev);
goto err_alloc;
}
 
-- 
1.8.3.1

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


[PATCH 19/38] net: atm: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 net/atm/atm_sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 350bf62..0e070c2 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -154,8 +154,10 @@ int atm_register_sysfs(struct atm_dev *adev, struct device 
*parent)
 
dev_set_name(cdev, "%s%d", adev->type, adev->number);
err = device_register(cdev);
-   if (err < 0)
+   if (err < 0) {
+   put_device(cdev);
return err;
+   }
 
for (i = 0; atm_attrs[i]; i++) {
err = device_create_file(cdev, atm_attrs[i]);
-- 
1.8.3.1

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


[PATCH 12/38] arm: s5pv210: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/arm/mach-s5pv210/common.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 26027a2..81f43ae 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -267,8 +267,14 @@ core_initcall(s5pv210_core_init);
 
 int __init s5pv210_init(void)
 {
+   int rc = 0;
+
printk(KERN_INFO "S5PV210: Initializing architecture\n");
-   return device_register(&s5pv210_dev);
+   rc = device_register(&s5pv210_dev);
+   if (rc)
+   put_device(&s5pv210_dev);
+
+   return rc;
 }
 
 /* uart registration process */
-- 
1.8.3.1

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


[PATCH 26/38] xen: xenbus: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/xen/xenbus/xenbus_probe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c 
b/drivers/xen/xenbus/xenbus_probe.c
index 3c0a74b..4abb9ee 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -465,8 +465,10 @@ int xenbus_probe_node(struct xen_bus_type *bus,
 
/* Register with generic device framework. */
err = device_register(&xendev->dev);
-   if (err)
+   if (err) {
+   put_device(&xendev->dev);
goto fail;
+   }
 
return 0;
 fail:
-- 
1.8.3.1

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


[PATCH 24/38] pcmcia: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/pcmcia/cs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 5292db6..5057de9 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -607,6 +607,7 @@ static int pccardd(void *__skt)
if (ret) {
dev_printk(KERN_WARNING, &skt->dev,
   "PCMCIA: unable to register socket\n");
+   put_device(&skt->dev);
skt->thread = NULL;
complete(&skt->thread_done);
return 0;
-- 
1.8.3.1

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


[PATCH 14/38] mips: txx9: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Also, rework error path so that it is easier to read.

Signed-off-by: Levente Kurusa 
---
 arch/mips/txx9/generic/setup.c | 27 +--
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 2b0b83c..24332f5 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -937,6 +937,12 @@ static ssize_t txx9_sram_write(struct file *filp, struct 
kobject *kobj,
return size;
 }
 
+void txx9_device_release(struct device *dev) {
+   struct txx9_sramc_dev *sramc_dev;
+   txx9_sramc_dev = container_of(dev, struct txx9_sramc_dev, dev);
+   kfree(txx9_sramc_dev);
+}
+
 void __init txx9_sramc_init(struct resource *r)
 {
struct txx9_sramc_dev *dev;
@@ -951,8 +957,11 @@ void __init txx9_sramc_init(struct resource *r)
return;
size = resource_size(r);
dev->base = ioremap(r->start, size);
-   if (!dev->base)
-   goto exit;
+   if (!dev->base) {
+   kfree(dev);
+   return;
+   }
+   dev->dev.release = &txx9_device_release;
dev->dev.bus = &txx9_sramc_subsys;
sysfs_bin_attr_init(&dev->bindata_attr);
dev->bindata_attr.attr.name = "bindata";
@@ -963,17 +972,15 @@ void __init txx9_sramc_init(struct resource *r)
dev->bindata_attr.private = dev;
err = device_register(&dev->dev);
if (err)
-   goto exit;
+   goto exit_put;
err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
if (err) {
device_unregister(&dev->dev);
-   goto exit;
-   }
-   return;
-exit:
-   if (dev) {
-   if (dev->base)
-   iounmap(dev->base);
+   iounmap(dev->base);
kfree(dev);
}
+   return;
+exit_put:
+   put_device(&dev->dev);
+   return;
 }
-- 
1.8.3.1

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


[PATCH 28/38] superhyway: intc: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 drivers/sh/intc/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 8f32a13..c89768e 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -504,8 +504,10 @@ static int __init register_intc_devs(void)
if (error == 0)
error = device_create_file(&d->dev,
   &dev_attr_name);
-   if (error)
+   if (error) {
+   put_device(&d->dev);
break;
+   }
}
}
 
-- 
1.8.3.1

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


[PATCH 30/38] vlynq: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
This will result in vlynq_device_release being called making the kfree()
in the errorpath unneccessary.

Signed-off-by: Levente Kurusa 
---
 drivers/vlynq/vlynq.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c
index 7b07135..71d5905 100644
--- a/drivers/vlynq/vlynq.c
+++ b/drivers/vlynq/vlynq.c
@@ -748,11 +748,14 @@ static int vlynq_probe(struct platform_device *pdev)
return 0;
 
 fail_register:
+   put_device(&dev->dev);
+   dev->dev = 0;
iounmap(dev->local);
 fail_remap:
 fail_request:
release_mem_region(regs_res->start, len);
-   kfree(dev);
+   if(dev)
+   kfree(dev);
return result;
 }
 
-- 
1.8.3.1

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


[PATCH 29/38] superhyway: maple: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.
Also rework maple_release_device to use maple_free_dev instead, avoiding
same code being in two functions at the same time.

Signed-off-by: Levente Kurusa 
---
 drivers/sh/maple/maple.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index bec81c2..c4afb7e 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -134,16 +134,18 @@ static int maple_dma_done(void)
return (__raw_readl(MAPLE_STATE) & 1) == 0;
 }
 
+static void maple_free_dev(struct maple_device *mdev)
+{
+   kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
+   kfree(mdev->mq);
+   kfree(mdev);
+}
+
 static void maple_release_device(struct device *dev)
 {
struct maple_device *mdev;
-   struct mapleq *mq;
-
mdev = to_maple_dev(dev);
-   mq = mdev->mq;
-   kmem_cache_free(maple_queue_cache, mq->recvbuf);
-   kfree(mq);
-   kfree(mdev);
+   maple_free_dev(mdev);
 }
 
 /**
@@ -234,13 +236,6 @@ static struct maple_device *maple_alloc_dev(int port, int 
unit)
return mdev;
 }
 
-static void maple_free_dev(struct maple_device *mdev)
-{
-   kmem_cache_free(maple_queue_cache, mdev->mq->recvbuf);
-   kfree(mdev->mq);
-   kfree(mdev);
-}
-
 /* process the command queue into a maple command block
  * terminating command has bit 32 of first long set to 0
  */
@@ -393,7 +388,7 @@ static void maple_attach_driver(struct maple_device *mdev)
dev_warn(&mdev->dev, "could not register device at"
" (%d, %d), with error 0x%X\n", mdev->unit,
mdev->port, error);
-   maple_free_dev(mdev);
+   put_device(&mdev->dev);
mdev = NULL;
return;
}
-- 
1.8.3.1

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


[PATCH 03/38] powerpc: cell: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/powerpc/platforms/cell/spu_base.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/cell/spu_base.c 
b/arch/powerpc/platforms/cell/spu_base.c
index f85db3a..f7fb0d9 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -597,6 +597,7 @@ static int spu_create_dev(struct spu *spu)
if (ret) {
printk(KERN_ERR "Can't register SPU %d with sysfs\n",
spu->number);
+   put_device(&spu->dev);
return ret;
}
 
-- 
1.8.3.1

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


[PATCH 01/38] sh: dma-sysfs: add missing put_device call

2013-12-19 Thread Levente Kurusa
This is required so that we give up the last reference to the device.

Signed-off-by: Levente Kurusa 
---
 arch/sh/drivers/dma/dma-sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c
index 4b15fed..76271e6 100644
--- a/arch/sh/drivers/dma/dma-sysfs.c
+++ b/arch/sh/drivers/dma/dma-sysfs.c
@@ -131,8 +131,10 @@ int dma_create_sysfs_files(struct dma_channel *chan, 
struct dma_info *info)
dev->bus = &dma_subsys;
 
ret = device_register(dev);
-   if (ret)
+   if (ret) {
+   put_device(dev);
return ret;
+   }
 
ret |= device_create_file(dev, &dev_attr_dev_id);
ret |= device_create_file(dev, &dev_attr_count);
-- 
1.8.3.1

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


  1   2   >