diff options
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 62696f865576..6c9b9be9e286 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1710,39 +1710,46 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) | |||
1710 | struct dvb_frontend *fe = dvbdev->priv; | 1710 | struct dvb_frontend *fe = dvbdev->priv; |
1711 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1711 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1712 | struct dvb_adapter *adapter = fe->dvb; | 1712 | struct dvb_adapter *adapter = fe->dvb; |
1713 | struct dvb_device *mfedev; | ||
1714 | struct dvb_frontend *mfe; | ||
1715 | struct dvb_frontend_private *mfepriv; | ||
1716 | int mferetry; | ||
1717 | int ret; | 1713 | int ret; |
1718 | 1714 | ||
1719 | dprintk ("%s\n", __func__); | 1715 | dprintk ("%s\n", __func__); |
1720 | 1716 | ||
1721 | if (adapter->mfe_shared) { | 1717 | if (adapter->mfe_shared) { |
1722 | mutex_lock (&adapter->mfe_lock); | 1718 | mutex_lock (&adapter->mfe_lock); |
1723 | if (adapter->mfe_dvbdev != dvbdev) { | 1719 | |
1724 | if (adapter->mfe_dvbdev) { | 1720 | if (adapter->mfe_dvbdev == NULL) |
1725 | mfedev = adapter->mfe_dvbdev; | 1721 | adapter->mfe_dvbdev = dvbdev; |
1726 | mfe = mfedev->priv; | 1722 | |
1727 | mfepriv = mfe->frontend_priv; | 1723 | else if (adapter->mfe_dvbdev != dvbdev) { |
1728 | mutex_unlock (&adapter->mfe_lock); | 1724 | struct dvb_device |
1729 | mferetry = (dvb_mfe_wait_time << 1); | 1725 | *mfedev = adapter->mfe_dvbdev; |
1730 | while (mferetry-- && (mfedev->users != -1 || mfepriv->thread != NULL)) { | 1726 | struct dvb_frontend |
1731 | if(msleep_interruptible(500)) { | 1727 | *mfe = mfedev->priv; |
1732 | if(signal_pending(current)) | 1728 | struct dvb_frontend_private |
1733 | return -EINTR; | 1729 | *mfepriv = mfe->frontend_priv; |
1734 | } | 1730 | int mferetry = (dvb_mfe_wait_time << 1); |
1731 | |||
1732 | mutex_unlock (&adapter->mfe_lock); | ||
1733 | while (mferetry-- && (mfedev->users != -1 || | ||
1734 | mfepriv->thread != NULL)) { | ||
1735 | if(msleep_interruptible(500)) { | ||
1736 | if(signal_pending(current)) | ||
1737 | return -EINTR; | ||
1735 | } | 1738 | } |
1736 | mutex_lock (&adapter->mfe_lock); | 1739 | } |
1740 | |||
1741 | mutex_lock (&adapter->mfe_lock); | ||
1742 | if(adapter->mfe_dvbdev != dvbdev) { | ||
1737 | mfedev = adapter->mfe_dvbdev; | 1743 | mfedev = adapter->mfe_dvbdev; |
1738 | mfe = mfedev->priv; | 1744 | mfe = mfedev->priv; |
1739 | mfepriv = mfe->frontend_priv; | 1745 | mfepriv = mfe->frontend_priv; |
1740 | if (mfedev->users != -1 || mfepriv->thread != NULL) { | 1746 | if (mfedev->users != -1 || |
1741 | ret = -EBUSY; | 1747 | mfepriv->thread != NULL) { |
1742 | goto err0; | 1748 | mutex_unlock (&adapter->mfe_lock); |
1749 | return -EBUSY; | ||
1743 | } | 1750 | } |
1751 | adapter->mfe_dvbdev = dvbdev; | ||
1744 | } | 1752 | } |
1745 | adapter->mfe_dvbdev = dvbdev; | ||
1746 | } | 1753 | } |
1747 | } | 1754 | } |
1748 | 1755 | ||