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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mc26u0n6tCXajnK3vhJ6N4acGgZp2atS0otGLZNSNhxpA@mail.gmail.com>
Date:   Wed, 27 Sep 2017 21:23:04 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Lars-Peter Clausen <lars@...afoo.de>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: dummy: evgen: use irq_sim

2017-09-27 19:12 GMT+02:00 Lars-Peter Clausen <lars@...afoo.de>:
> On 09/26/2017 06:49 PM, Bartosz Golaszewski wrote:
>> Switch to using the recently added interrupt simulator for dummy irqs.
>>
>> Signed-off-by: Bartosz Golaszewski <brgl@...ev.pl>
>
> Thanks for doing this.
>
> [...]
>>  static int iio_dummy_evgen_create(void)
>>  {
>> -     int ret, i;
>> +     int ret;
>>
>>       iio_evgen = kzalloc(sizeof(*iio_evgen), GFP_KERNEL);
>>       if (!iio_evgen)
>>               return -ENOMEM;
>>
>> -     iio_evgen->base = irq_alloc_descs(-1, 0, IIO_EVENTGEN_NO, 0);
>> -     if (iio_evgen->base < 0) {
>> -             ret = iio_evgen->base;
>> -             kfree(iio_evgen);
>> +     ret = irq_sim_init(&iio_evgen->irq_sim, IIO_EVENTGEN_NO);
>> +     if (ret)
>
> What happened to the kfree(iio_evgen)?
>

Oops, nice catch, thanks!

>>               return ret;
>> -     }
>> -     iio_evgen->chip.name = iio_evgen_name;
>> -     iio_evgen->chip.irq_mask = &iio_dummy_event_irqmask;
>> -     iio_evgen->chip.irq_unmask = &iio_dummy_event_irqunmask;
>> -     for (i = 0; i < IIO_EVENTGEN_NO; i++) {
>> -             irq_set_chip(iio_evgen->base + i, &iio_evgen->chip);
>> -             irq_set_handler(iio_evgen->base + i, &handle_simple_irq);
>> -             irq_modify_status(iio_evgen->base + i,
>> -                               IRQ_NOREQUEST | IRQ_NOAUTOEN,
>> -                               IRQ_NOPROBE);
>> -     }
>> -     init_irq_work(&iio_evgen->handler.work, iio_dummy_work_handler);
>> +
>> +     iio_evgen->base = irq_sim_irqnum(&iio_evgen->irq_sim, 0);
> I saw you introduced irq_sim_baseirq(), to get rid of ->base. But as far as
> I can see the only remaining places where we need the base is to do the
> reverse lookup from IRQ to index. It would be nice if the irq_sim had a
> function for that, then we wouldn't have to know about the base at all.
>

I'm not sure I understand. Irq sim doesn't know anything about iio
data structures, so how would such a reverse lookup work in this case?

Best regards,
Bartosz Golaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ