lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 16 Dec 2014 10:00:48 +0800
From:	Ley Foon Tan <lftan@...era.com>
To:	Dinh Nguyen <dinh.linux@...il.com>
Cc:	Jassi Brar <jassisinghbrar@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Suman Anna <s-anna@...com>, devicetree@...r.kernel.org
Subject: Re: [PATCH (resend)] mailbox: Add Altera mailbox driver

On Mon, Dec 15, 2014 at 10:22 PM, Dinh Nguyen <dinh.linux@...il.com> wrote:
>
>
> On 12/15/14, 12:22 AM, Ley Foon Tan wrote:
>> On Fri, Dec 12, 2014 at 10:38 PM, Dinh Nguyen <dinh.linux@...il.com> wrote:
>>
>>>> +
>>>> +#include <linux/kernel.h>
>>>> +#include <linux/module.h>
>>>> +#include <linux/device.h>
>>>> +#include <linux/platform_device.h>
>>>> +#include <linux/interrupt.h>
>>>> +#include <linux/io.h>
>>>> +#include <linux/of.h>
>>>> +#include <linux/mailbox_controller.h>
>>>
>>> Alphabetize the headers.
>> Okay.
>>
>>
>>>> +static int altera_mbox_startup_sender(struct mbox_chan *chan)
>>>> +{
>>>> +     int ret;
>>>> +     struct altera_mbox *mbox = to_altera_mbox(chan);
>>>> +
>>>> +     if (mbox->intr_mode) {
>>>> +             ret = request_irq(mbox->irq, altera_mbox_tx_interrupt, 0,
>>>
>>> Use devm_request_irq, since you didn't have and don't need use free_irq
>>> in the shutdown function.
>> We want to free_irq when it shutdown. That means nobody requests for
>> that mailbox (or channel) and request_irq() again if someone requests
>> for a mailbox.
>>
>
> But you didn't have any free_irq in the shutdown function. Use
> devm_request_irq here, so you don't have to add them.

Hi Dinh

free_irq() is in  altera_mbox_shutdown(). This function will be called
when user free/release the mailbox (channel).
But, devm_free_irq() only will be called when unload the module.

+static void altera_mbox_shutdown(struct mbox_chan *chan)
+{
+       struct altera_mbox *mbox = to_altera_mbox(chan);
+
+       if (WARN_ON(!mbox))
+               return;
+
+       if (mbox->intr_mode) {
+               /* Unmask all interrupt masks */
+               __raw_writel(~0, mbox->mbox_base + MAILBOX_INTMASK_REG);
+               free_irq(mbox->irq, chan);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ