Message ID | m3twuiwc3j.fsf@t19.piap.pl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 08 Jun 2015 15:42:24 +0200 khalasa@piap.pl (Krzysztof Ha?asa) wrote: > readl() and writel() are atomic, we don't need the spin lock. > Also, flushing posted write buffer isn't required. Especially on > read :-) > > Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> > > --- a/drivers/media/pci/solo6x10/solo6x10-core.c > +++ b/drivers/media/pci/solo6x10/solo6x10-core.c > @@ -483,7 +483,6 @@ static int solo_pci_probe(struct pci_dev *pdev, > const struct pci_device_id *id) > solo_dev->type = id->driver_data; > solo_dev->pdev = pdev; > - spin_lock_init(&solo_dev->reg_io_lock); > ret = v4l2_device_register(&pdev->dev, &solo_dev->v4l2_dev); > if (ret) > goto fail_probe; > --- a/drivers/media/pci/solo6x10/solo6x10.h > +++ b/drivers/media/pci/solo6x10/solo6x10.h > @@ -201,7 +201,6 @@ struct solo_dev { > int nr_ext; > u32 irq_mask; > u32 motion_mask; > - spinlock_t reg_io_lock; > struct v4l2_device v4l2_dev; > > /* tw28xx accounting */ > @@ -283,36 +282,13 @@ struct solo_dev { > > static inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg) > { > - unsigned long flags; > - u32 ret; > - u16 val; > - > - spin_lock_irqsave(&solo_dev->reg_io_lock, flags); > - > - ret = readl(solo_dev->reg_base + reg); > - rmb(); > - pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val); > - rmb(); > - > - spin_unlock_irqrestore(&solo_dev->reg_io_lock, flags); > - > - return ret; > + return readl(solo_dev->reg_base + reg); > } > > static inline void solo_reg_write(struct solo_dev *solo_dev, int reg, > u32 data) > { > - unsigned long flags; > - u16 val; > - > - spin_lock_irqsave(&solo_dev->reg_io_lock, flags); > - > writel(data, solo_dev->reg_base + reg); > - wmb(); > - pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val); > - rmb(); > - > - spin_unlock_irqrestore(&solo_dev->reg_io_lock, flags); > } > > static inline void solo_irq_on(struct solo_dev *dev, u32 mask) Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c @@ -483,7 +483,6 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) solo_dev->type = id->driver_data; solo_dev->pdev = pdev; - spin_lock_init(&solo_dev->reg_io_lock); ret = v4l2_device_register(&pdev->dev, &solo_dev->v4l2_dev); if (ret) goto fail_probe; --- a/drivers/media/pci/solo6x10/solo6x10.h +++ b/drivers/media/pci/solo6x10/solo6x10.h @@ -201,7 +201,6 @@ struct solo_dev { int nr_ext; u32 irq_mask; u32 motion_mask; - spinlock_t reg_io_lock; struct v4l2_device v4l2_dev; /* tw28xx accounting */ @@ -283,36 +282,13 @@ struct solo_dev { static inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg) { - unsigned long flags; - u32 ret; - u16 val; - - spin_lock_irqsave(&solo_dev->reg_io_lock, flags); - - ret = readl(solo_dev->reg_base + reg); - rmb(); - pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val); - rmb(); - - spin_unlock_irqrestore(&solo_dev->reg_io_lock, flags); - - return ret; + return readl(solo_dev->reg_base + reg); } static inline void solo_reg_write(struct solo_dev *solo_dev, int reg, u32 data) { - unsigned long flags; - u16 val; - - spin_lock_irqsave(&solo_dev->reg_io_lock, flags); - writel(data, solo_dev->reg_base + reg); - wmb(); - pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val); - rmb(); - - spin_unlock_irqrestore(&solo_dev->reg_io_lock, flags); } static inline void solo_irq_on(struct solo_dev *dev, u32 mask)
readl() and writel() are atomic, we don't need the spin lock. Also, flushing posted write buffer isn't required. Especially on read :-) Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html