18
18
*/
19
19
20
20
#define pr_fmt (fmt ) "AMD-Vi: " fmt
21
+ #define dev_fmt (fmt ) pr_fmt(fmt)
21
22
22
23
#include <linux/ratelimit.h>
23
24
#include <linux/pci.h>
@@ -279,10 +280,10 @@ static u16 get_alias(struct device *dev)
279
280
return pci_alias ;
280
281
}
281
282
282
- pr_info ( "Using IVRS reported alias %02x:%02x.%d "
283
- "for device %s [%04x:%04x], kernel reported alias "
283
+ pci_info ( pdev , "Using IVRS reported alias %02x:%02x.%d "
284
+ "for device [%04x:%04x], kernel reported alias "
284
285
"%02x:%02x.%d\n" , PCI_BUS_NUM (ivrs_alias ), PCI_SLOT (ivrs_alias ),
285
- PCI_FUNC (ivrs_alias ), dev_name ( dev ), pdev -> vendor , pdev -> device ,
286
+ PCI_FUNC (ivrs_alias ), pdev -> vendor , pdev -> device ,
286
287
PCI_BUS_NUM (pci_alias ), PCI_SLOT (pci_alias ),
287
288
PCI_FUNC (pci_alias ));
288
289
@@ -293,9 +294,8 @@ static u16 get_alias(struct device *dev)
293
294
if (pci_alias == devid &&
294
295
PCI_BUS_NUM (ivrs_alias ) == pdev -> bus -> number ) {
295
296
pci_add_dma_alias (pdev , ivrs_alias & 0xff );
296
- pr_info ("Added PCI DMA alias %02x.%d for %s\n" ,
297
- PCI_SLOT (ivrs_alias ), PCI_FUNC (ivrs_alias ),
298
- dev_name (dev ));
297
+ pci_info (pdev , "Added PCI DMA alias %02x.%d\n" ,
298
+ PCI_SLOT (ivrs_alias ), PCI_FUNC (ivrs_alias ));
299
299
}
300
300
301
301
return ivrs_alias ;
@@ -545,7 +545,7 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id,
545
545
dev_data = get_dev_data (& pdev -> dev );
546
546
547
547
if (dev_data && __ratelimit (& dev_data -> rs )) {
548
- dev_err ( & pdev -> dev , "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n" ,
548
+ pci_err ( pdev , "Event logged [IO_PAGE_FAULT domain=0x%04x address=0x%llx flags=0x%04x]\n" ,
549
549
domain_id , address , flags );
550
550
} else if (printk_ratelimit ()) {
551
551
pr_err ("Event logged [IO_PAGE_FAULT device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n" ,
@@ -2251,8 +2251,7 @@ static int amd_iommu_add_device(struct device *dev)
2251
2251
ret = iommu_init_device (dev );
2252
2252
if (ret ) {
2253
2253
if (ret != - ENOTSUPP )
2254
- pr_err ("Failed to initialize device %s - trying to proceed anyway\n" ,
2255
- dev_name (dev ));
2254
+ dev_err (dev , "Failed to initialize - trying to proceed anyway\n" );
2256
2255
2257
2256
iommu_ignore_device (dev );
2258
2257
dev -> dma_ops = NULL ;
@@ -2605,8 +2604,8 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
2605
2604
return nelems ;
2606
2605
2607
2606
out_unmap :
2608
- pr_err ( "%s: IOMMU mapping error in %s (io-pages: %d) reason: %d\n" ,
2609
- dev_name ( dev ), __func__ , npages , ret );
2607
+ dev_err ( dev , " IOMMU mapping error in map_sg (io-pages: %d reason: %d) \n" ,
2608
+ npages , ret );
2610
2609
2611
2610
for_each_sg (sglist , s , nelems , i ) {
2612
2611
int j , pages = iommu_num_pages (sg_phys (s ), s -> length , PAGE_SIZE );
@@ -2800,7 +2799,7 @@ static int init_reserved_iova_ranges(void)
2800
2799
IOVA_PFN (r -> start ),
2801
2800
IOVA_PFN (r -> end ));
2802
2801
if (!val ) {
2803
- pr_err ( "Reserve pci-resource range failed\n" );
2802
+ pci_err ( pdev , "Reserve pci-resource range %pR failed\n" , r );
2804
2803
return - ENOMEM ;
2805
2804
}
2806
2805
}
@@ -3170,8 +3169,7 @@ static void amd_iommu_get_resv_regions(struct device *dev,
3170
3169
length , prot ,
3171
3170
IOMMU_RESV_DIRECT );
3172
3171
if (!region ) {
3173
- pr_err ("Out of memory allocating dm-regions for %s\n" ,
3174
- dev_name (dev ));
3172
+ dev_err (dev , "Out of memory allocating dm-regions\n" );
3175
3173
return ;
3176
3174
}
3177
3175
list_add_tail (& region -> list , head );
0 commit comments