Re: [PATCH v2 5/5] iommu/amd - Add a debugfs entry to specify a IOMMU device table entry

From: Gary R Hook
Date: Tue Mar 13 2018 - 14:54:30 EST


On 03/13/2018 12:20 PM, Andy Shevchenko wrote:

+ oboff += OSCNPRINTF("%02x:%02x:%x (%u / %04x)\n",
+ PCI_BUS_NUM(amd_iommu_devid),
+ PCI_SLOT(amd_iommu_devid),
+ PCI_FUNC(amd_iommu_devid),

Perhaps at some point we will have an extension to %p to print PCI BDFs.

But until then.... ;-)

+ if (strnchr(obuf, OBUFLEN, ':'))
+ {

Style

D'oh!

+ } else if (obuf[0] == '0' && obuf[1] == 'x') {
+ n = sscanf(obuf, "%x", &amd_iommu_devid);
+ } else {
+ n = sscanf(obuf, "%d", &amd_iommu_devid);
+ }

kstrtoint() ?

I see various mechanisms for this sort of thing, and simply chose one.
Am happy to use whatever is preferred.