Re: [PATCH 1/2] PCI: replace hard-coded resource index by macros

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

 



Pavel Roskin wrote:
On Wed, 2009-02-18 at 01:56 +0800, Yu Zhao wrote:
+#define PCI_BRIDGE_RESOURCE_NUM (PCI_BRIDGE_MAX_RESOURCE >	\
+				 PCI_CARDBUS_MAX_RESOURCE ?	\
+				 PCI_BRIDGE_MAX_RESOURCE :	\
+				 PCI_CARDBUS_MAX_RESOURCE)

This looks too complicated for my taste.  I would just keep the old
definition, or I would use a comment:

/* Maximal number of bridge resources */
#define PCI_BRIDGE_RESOURCE_NUM PCI_CARDBUS_MAX_RESOURCE

It's not like PCI_BRIDGE_MAX_RESOURCE can grow suddenly and surpass
PCI_CARDBUS_MAX_RESOURCE.

Yes, given that assumption, using the #define should be fine.


At very least, I would try to use max() to make it more readable.

max() won't work when the macro is used to assign value to the member of enum.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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