All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] PATCH : msi patch rtcan_peak_pci
@ 2014-12-18 16:53 Frederik Bayart
  2014-12-18 17:44 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Frederik Bayart @ 2014-12-18 16:53 UTC (permalink / raw)
  To: xenomai

Hallo,

We have added msi to the rtcan_peak_pci driver
In attachment a zip file containing the old and the new rtcan_peak_pci.c
and the patch.
Can this patch be applied the the source tree ?

Kind regards,

Frederik Bayart | Senior software engineer
Triphase NV | Research Park Zone 1719 | Romeinse straat 18 | B-3001 Heverlee
T  +32 2 669 06 05 | E frederik.bayart@triphase.com | W www.triphase.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtcan_peak_pci.zip
Type: application/zip
Size: 7382 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20141218/fd15eff1/attachment.zip>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai] PATCH : msi patch rtcan_peak_pci
  2014-12-18 16:53 [Xenomai] PATCH : msi patch rtcan_peak_pci Frederik Bayart
@ 2014-12-18 17:44 ` Gilles Chanteperdrix
  2014-12-19 11:20   ` Frederik Bayart
  0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2014-12-18 17:44 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On Thu, Dec 18, 2014 at 05:53:33PM +0100, Frederik Bayart wrote:
> Hallo,
> 
> We have added msi to the rtcan_peak_pci driver
> In attachment a zip file containing the old and the new rtcan_peak_pci.c
> and the patch.
> Can this patch be applied the the source tree ?

Please send the patch alone, preferably inline, or as an attachment.
This makes review and comment easier.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai] PATCH : msi patch rtcan_peak_pci
  2014-12-18 17:44 ` Gilles Chanteperdrix
@ 2014-12-19 11:20   ` Frederik Bayart
  2014-12-19 14:57     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Frederik Bayart @ 2014-12-19 11:20 UTC (permalink / raw)
  To: xenomai

On 18 December 2014 at 18:44, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> On Thu, Dec 18, 2014 at 05:53:33PM +0100, Frederik Bayart wrote:
>> Hallo,
>>
>> We have added msi to the rtcan_peak_pci driver
>> In attachment a zip file containing the old and the new rtcan_peak_pci.c
>> and the patch.
>> Can this patch be applied the the source tree ?
>
> Please send the patch alone, preferably inline, or as an attachment.
> This makes review and comment easier.
>
> --
>                                             Gilles.

Gilles,

Below the patch. I used  xenomai-3-3.0-rc2.tar because I haven't used
git yet but I verified that the
driver source didn't changed in git
(http://git.xenomai.org/xenomai-3.git/plain/kernel/drivers/can/sja1000/rtcan_peak_pci.c)

Frederik

--- a/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-10-31
15:18:44.000000000 +0100
+++ b/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-12-18
17:44:21.799350602 +0100
@@ -301,6 +301,8 @@
     if ((ret = pci_write_config_word(pdev, 0x44, 0)))
     goto failure_cleanup;

+    pci_enable_msi(pdev);
+
     if (sub_sys_id > 3) {
     if ((ret = rtcan_peak_pci_add_chan(pdev, CHANNEL_MASTER,
                        &master_dev)))
@@ -337,6 +339,8 @@
     rtcan_peak_pci_del_chan(board->slave_dev, 0);
     rtcan_peak_pci_del_chan(dev, 0);

+    pci_disable_msi(pdev);
+
     pci_release_regions(pdev);
     pci_disable_device(pdev);
     pci_set_drvdata(pdev, NULL);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai] PATCH : msi patch rtcan_peak_pci
  2014-12-19 11:20   ` Frederik Bayart
@ 2014-12-19 14:57     ` Gilles Chanteperdrix
  2014-12-19 15:15       ` Jan Kiszka
  2014-12-19 16:46       ` Frederik Bayart
  0 siblings, 2 replies; 6+ messages in thread
From: Gilles Chanteperdrix @ 2014-12-19 14:57 UTC (permalink / raw)
  To: Frederik Bayart; +Cc: xenomai

On Fri, Dec 19, 2014 at 12:20:13PM +0100, Frederik Bayart wrote:
> On 18 December 2014 at 18:44, Gilles Chanteperdrix
> <gilles.chanteperdrix@xenomai.org> wrote:
> > On Thu, Dec 18, 2014 at 05:53:33PM +0100, Frederik Bayart wrote:
> >> Hallo,
> >>
> >> We have added msi to the rtcan_peak_pci driver
> >> In attachment a zip file containing the old and the new rtcan_peak_pci.c
> >> and the patch.
> >> Can this patch be applied the the source tree ?
> >
> > Please send the patch alone, preferably inline, or as an attachment.
> > This makes review and comment easier.
> >
> > --
> >                                             Gilles.
> 
> Gilles,
> 
> Below the patch. I used  xenomai-3-3.0-rc2.tar because I haven't used
> git yet but I verified that the
> driver source didn't changed in git
> (http://git.xenomai.org/xenomai-3.git/plain/kernel/drivers/can/sja1000/rtcan_peak_pci.c)
> 
> Frederik
> 
> --- a/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-10-31
> 15:18:44.000000000 +0100
> +++ b/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-12-18
> 17:44:21.799350602 +0100
> @@ -301,6 +301,8 @@
>      if ((ret = pci_write_config_word(pdev, 0x44, 0)))
>      goto failure_cleanup;
> 
> +    pci_enable_msi(pdev);
> +

You should get pci_enable_msi return status, and...

>      if (sub_sys_id > 3) {
>      if ((ret = rtcan_peak_pci_add_chan(pdev, CHANNEL_MASTER,
>                         &master_dev)))
> @@ -337,6 +339,8 @@
>      rtcan_peak_pci_del_chan(board->slave_dev, 0);
>      rtcan_peak_pci_del_chan(dev, 0);
> 
> +    pci_disable_msi(pdev);
> +

if it failed, do not use pci_disable_msi.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai] PATCH : msi patch rtcan_peak_pci
  2014-12-19 14:57     ` Gilles Chanteperdrix
@ 2014-12-19 15:15       ` Jan Kiszka
  2014-12-19 16:46       ` Frederik Bayart
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2014-12-19 15:15 UTC (permalink / raw)
  To: Gilles Chanteperdrix, Frederik Bayart; +Cc: xenomai

On 2014-12-19 15:57, Gilles Chanteperdrix wrote:
> On Fri, Dec 19, 2014 at 12:20:13PM +0100, Frederik Bayart wrote:
>> On 18 December 2014 at 18:44, Gilles Chanteperdrix
>> <gilles.chanteperdrix@xenomai.org> wrote:
>>> On Thu, Dec 18, 2014 at 05:53:33PM +0100, Frederik Bayart wrote:
>>>> Hallo,
>>>>
>>>> We have added msi to the rtcan_peak_pci driver
>>>> In attachment a zip file containing the old and the new rtcan_peak_pci.c
>>>> and the patch.
>>>> Can this patch be applied the the source tree ?
>>>
>>> Please send the patch alone, preferably inline, or as an attachment.
>>> This makes review and comment easier.
>>>
>>> --
>>>                                             Gilles.
>>
>> Gilles,
>>
>> Below the patch. I used  xenomai-3-3.0-rc2.tar because I haven't used
>> git yet but I verified that the
>> driver source didn't changed in git
>> (http://git.xenomai.org/xenomai-3.git/plain/kernel/drivers/can/sja1000/rtcan_peak_pci.c)
>>
>> Frederik
>>
>> --- a/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-10-31
>> 15:18:44.000000000 +0100
>> +++ b/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-12-18
>> 17:44:21.799350602 +0100
>> @@ -301,6 +301,8 @@
>>      if ((ret = pci_write_config_word(pdev, 0x44, 0)))
>>      goto failure_cleanup;
>>
>> +    pci_enable_msi(pdev);
>> +
> 
> You should get pci_enable_msi return status, and...
> 
>>      if (sub_sys_id > 3) {
>>      if ((ret = rtcan_peak_pci_add_chan(pdev, CHANNEL_MASTER,
>>                         &master_dev)))
>> @@ -337,6 +339,8 @@
>>      rtcan_peak_pci_del_chan(board->slave_dev, 0);
>>      rtcan_peak_pci_del_chan(dev, 0);
>>
>> +    pci_disable_msi(pdev);
>> +
> 
> if it failed, do not use pci_disable_msi.
> 

And I suspect that - if no other magic path does this - you also need
pci_set_master. Without master mode enabled, the device will not send
any MSIs (unless it violates the PCI spec).

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai] PATCH : msi patch rtcan_peak_pci
  2014-12-19 14:57     ` Gilles Chanteperdrix
  2014-12-19 15:15       ` Jan Kiszka
@ 2014-12-19 16:46       ` Frederik Bayart
  1 sibling, 0 replies; 6+ messages in thread
From: Frederik Bayart @ 2014-12-19 16:46 UTC (permalink / raw)
  To: xenomai

On 19 December 2014 at 15:57, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> On Fri, Dec 19, 2014 at 12:20:13PM +0100, Frederik Bayart wrote:
>> On 18 December 2014 at 18:44, Gilles Chanteperdrix
>> <gilles.chanteperdrix@xenomai.org> wrote:
>> > On Thu, Dec 18, 2014 at 05:53:33PM +0100, Frederik Bayart wrote:
>> >> Hallo,
>> >>
>> >> We have added msi to the rtcan_peak_pci driver
>> >> In attachment a zip file containing the old and the new rtcan_peak_pci.c
>> >> and the patch.
>> >> Can this patch be applied the the source tree ?
>> >
>> > Please send the patch alone, preferably inline, or as an attachment.
>> > This makes review and comment easier.
>> >
>> > --
>> >                                             Gilles.
>>
>> Gilles,
>>
>> Below the patch. I used  xenomai-3-3.0-rc2.tar because I haven't used
>> git yet but I verified that the
>> driver source didn't changed in git
>> (http://git.xenomai.org/xenomai-3.git/plain/kernel/drivers/can/sja1000/rtcan_peak_pci.c)
>>
>> Frederik
>>
>> --- a/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-10-31
>> 15:18:44.000000000 +0100
>> +++ b/kernel/drivers/can/sja1000/rtcan_peak_pci.c    2014-12-18
>> 17:44:21.799350602 +0100
>> @@ -301,6 +301,8 @@
>>      if ((ret = pci_write_config_word(pdev, 0x44, 0)))
>>      goto failure_cleanup;
>>
>> +    pci_enable_msi(pdev);
>> +
>
> You should get pci_enable_msi return status, and...
>
>>      if (sub_sys_id > 3) {
>>      if ((ret = rtcan_peak_pci_add_chan(pdev, CHANNEL_MASTER,
>>                         &master_dev)))
>> @@ -337,6 +339,8 @@
>>      rtcan_peak_pci_del_chan(board->slave_dev, 0);
>>      rtcan_peak_pci_del_chan(dev, 0);
>>
>> +    pci_disable_msi(pdev);
>> +
>
> if it failed, do not use pci_disable_msi.
>
> --
>                                             Gilles.

Is this necessary ? A lot of drivers seems to do this, but this check
is also done in pci_disable_msi :

void pci_disable_msi(struct pci_dev *dev)
{
        if (!pci_msi_enable || !dev || !dev->msi_enabled)
                return;

        pci_msi_shutdown(dev);
        free_msi_irqs(dev);
}


dev->msi_enabled is set at the end of pci_enable_msi

Frederik


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-19 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18 16:53 [Xenomai] PATCH : msi patch rtcan_peak_pci Frederik Bayart
2014-12-18 17:44 ` Gilles Chanteperdrix
2014-12-19 11:20   ` Frederik Bayart
2014-12-19 14:57     ` Gilles Chanteperdrix
2014-12-19 15:15       ` Jan Kiszka
2014-12-19 16:46       ` Frederik Bayart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.