@@ -709,9 +709,8 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
709
709
if (pdev == NULL )
710
710
goto out ;
711
711
712
- pdev -> sh_info =
713
- (struct xen_pci_sharedinfo * )__get_free_page (GFP_KERNEL );
714
- if (pdev -> sh_info == NULL ) {
712
+ if (xenbus_setup_ring (xdev , GFP_KERNEL , (void * * )& pdev -> sh_info , 1 ,
713
+ & pdev -> gnt_ref )) {
715
714
kfree (pdev );
716
715
pdev = NULL ;
717
716
goto out ;
@@ -729,7 +728,6 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
729
728
spin_lock_init (& pdev -> sh_info_lock );
730
729
731
730
pdev -> evtchn = INVALID_EVTCHN ;
732
- pdev -> gnt_ref = INVALID_GRANT_REF ;
733
731
pdev -> irq = -1 ;
734
732
735
733
INIT_WORK (& pdev -> op_work , pcifront_do_aer );
@@ -754,11 +752,7 @@ static void free_pdev(struct pcifront_device *pdev)
754
752
if (pdev -> evtchn != INVALID_EVTCHN )
755
753
xenbus_free_evtchn (pdev -> xdev , pdev -> evtchn );
756
754
757
- if (pdev -> gnt_ref != INVALID_GRANT_REF )
758
- gnttab_end_foreign_access (pdev -> gnt_ref ,
759
- (unsigned long )pdev -> sh_info );
760
- else
761
- free_page ((unsigned long )pdev -> sh_info );
755
+ xenbus_teardown_ring ((void * * )& pdev -> sh_info , 1 , & pdev -> gnt_ref );
762
756
763
757
dev_set_drvdata (& pdev -> xdev -> dev , NULL );
764
758
@@ -769,13 +763,6 @@ static int pcifront_publish_info(struct pcifront_device *pdev)
769
763
{
770
764
int err = 0 ;
771
765
struct xenbus_transaction trans ;
772
- grant_ref_t gref ;
773
-
774
- err = xenbus_grant_ring (pdev -> xdev , pdev -> sh_info , 1 , & gref );
775
- if (err < 0 )
776
- goto out ;
777
-
778
- pdev -> gnt_ref = gref ;
779
766
780
767
err = xenbus_alloc_evtchn (pdev -> xdev , & pdev -> evtchn );
781
768
if (err )
0 commit comments