<story><title>A GPIO Driver in Rust</title><url>https://lwn.net/Articles/863459/</url></story><parent_chain><item><author>secondcoming</author><text>In the function &amp;#x27;pl061_irq_type&amp;#x27; the original code has (line 224):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    writeb(gpiois, pl061-&amp;gt;base + GPIOIS);
    writeb(gpioibe, pl061-&amp;gt;base + GPIOIBE);
    writeb(gpioiev, pl061-&amp;gt;base + GPIOIEV);
&lt;/code&gt;&lt;/pre&gt;
but the translated code has a differing order:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    pl061.base.writeb(gpioiev, GPIOIEV);
    pl061.base.writeb(gpiois, GPIOIS);
    pl061.base.writeb(gpioibe, GPIOIBE);
&lt;/code&gt;&lt;/pre&gt;
Isn&amp;#x27;t the order of operations important when talking to I&amp;#x2F;O?</text></item></parent_chain><comment><author>tialaramex</author><text>In this case GPIOIS, GPIOIBE and GPIOIEV are basically three registers that between them determine how interrupts work for each pin. Do you want edges or level triggered? &lt;i&gt;Both&lt;/i&gt; edges or just one? High levels or low? Order likely makes no practical difference whatsoever.&lt;p&gt;The data sheet actually suggests a particular course of action if you desire edge triggered interrupts but that recommendation doesn&amp;#x27;t match what either driver actually does here. Real world experience suggests that &amp;quot;Follow the exact steps from the data sheet&amp;quot; is a worthwhile diagnostic step when the driver &lt;i&gt;doesn&amp;#x27;t&lt;/i&gt; work but probably not worth doing if your driver works. AIUI this driver works.&lt;p&gt;It sounds like the worst thing that can go wrong is you eat one spurious interrupt because something happened to the GPIO pin you cared about while you were meddling with the interrupt handling. Confusing for a tightly coded embedded system, but probably unnoticeable in the Linux ecosystem.</text></comment>
<story><title>A GPIO Driver in Rust</title><url>https://lwn.net/Articles/863459/</url></story><parent_chain><item><author>secondcoming</author><text>In the function &amp;#x27;pl061_irq_type&amp;#x27; the original code has (line 224):&lt;p&gt;&lt;pre&gt;&lt;code&gt;    writeb(gpiois, pl061-&amp;gt;base + GPIOIS);
    writeb(gpioibe, pl061-&amp;gt;base + GPIOIBE);
    writeb(gpioiev, pl061-&amp;gt;base + GPIOIEV);
&lt;/code&gt;&lt;/pre&gt;
but the translated code has a differing order:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    pl061.base.writeb(gpioiev, GPIOIEV);
    pl061.base.writeb(gpiois, GPIOIS);
    pl061.base.writeb(gpioibe, GPIOIBE);
&lt;/code&gt;&lt;/pre&gt;
Isn&amp;#x27;t the order of operations important when talking to I&amp;#x2F;O?</text></item></parent_chain><comment><author>floatingatoll</author><text>I&amp;#x27;ve read through a chunk of the thread and no one has mentioned that on the list yet.&lt;p&gt;You could, I imagine, submit that as a Pull Request here:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;wedsonaf&amp;#x2F;linux&amp;#x2F;tree&amp;#x2F;pl061&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;wedsonaf&amp;#x2F;linux&amp;#x2F;tree&amp;#x2F;pl061&lt;/a&gt;&lt;p&gt;Or you can email a note about it to the author at the email address shown in the thread archives.&lt;p&gt;Either way, I bet they&amp;#x27;d like to know about the order swap and either add a code comment or unswap it.</text></comment>