Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen/tpmfront: use xenbus_setup_ring() and xenbus_teardown_ring()

Simplify tpmfront's ring creation and removal via xenbus_setup_ring()
and xenbus_teardown_ring(), which are provided exactly for the use
pattern as seen in this driver.

Signed-off-by: Juergen Gross <jgross@suse.com>

+3 -15
+3 -15
drivers/char/tpm/xen-tpmfront.c
··· 253 253 struct xenbus_transaction xbt; 254 254 const char *message = NULL; 255 255 int rv; 256 - grant_ref_t gref; 257 256 258 - priv->shr = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO); 259 - if (!priv->shr) { 260 - xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring"); 261 - return -ENOMEM; 262 - } 263 - 264 - rv = xenbus_grant_ring(dev, priv->shr, 1, &gref); 257 + rv = xenbus_setup_ring(dev, GFP_KERNEL, (void **)&priv->shr, 1, 258 + &priv->ring_ref); 265 259 if (rv < 0) 266 260 return rv; 267 - 268 - priv->ring_ref = gref; 269 261 270 262 rv = xenbus_alloc_evtchn(dev, &priv->evtchn); 271 263 if (rv) ··· 323 331 if (!priv) 324 332 return; 325 333 326 - if (priv->ring_ref) 327 - gnttab_end_foreign_access(priv->ring_ref, 328 - (unsigned long)priv->shr); 329 - else 330 - free_page((unsigned long)priv->shr); 334 + xenbus_teardown_ring((void **)&priv->shr, 1, &priv->ring_ref); 331 335 332 336 if (priv->irq) 333 337 unbind_from_irqhandler(priv->irq, priv);