Re: [PATCH v4 0/4] Simplify PCIe hotplug indicator control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux