lkml.org 
[lkml]   [2019]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 0/4] Simplify PCIe hotplug indicator control
On Thu, Sep 05, 2019 at 04:01:02PM -0500, Bjorn Helgaas wrote:
> void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn)
> {
> u16 cmd = 0, mask = 0;
>
> - if (PWR_LED(ctrl) && pwr > 0) {
> - cmd |= pwr;
> + if (PWR_LED(ctrl) && pwr != INDICATOR_NOOP) {
> + cmd |= (pwr & PCI_EXP_SLTCTL_PIC);
> mask |= PCI_EXP_SLTCTL_PIC;
> }
>
> - if (ATTN_LED(ctrl) && attn > 0) {
> - cmd |= attn;
> + if (ATTN_LED(ctrl) && attn != INDICATOR_NOOP) {
> + cmd |= (attn & PCI_EXP_SLTCTL_AIC);
> mask |= PCI_EXP_SLTCTL_AIC;
> }

There's a subtle issue here: A value of "0" is "reserved" per PCIe r4.0,
sec 7.8.10. Denis filtered that out, with your change it's an accepted
value. I don't think the function ever gets called with a value of "0",
so it's not a big deal. And maybe we don't even want to filter that
value out. Just noting anyway.

Thanks,

Lukas

\
 
 \ /
  Last update: 2019-09-06 00:03    [W:0.064 / U:3.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site