* pci_set_consistent_dma_mask() question
@ 2008-05-25 5:43 Marin Mitov
2008-05-25 18:59 ` Arjan van de Ven
0 siblings, 1 reply; 2+ messages in thread
From: Marin Mitov @ 2008-05-25 5:43 UTC (permalink / raw)
To: linux-kernel; +Cc: netdev
Hi all,
In the file: Documentation/DMA-mapping.txt is written:
pci_set_consistent_dma_mask() will always be able to set the same or a
smaller mask as pci_set_dma_mask(). However for the rare case that a
device driver only uses consistent allocations, one would have to
check the return value from pci_set_consistent_dma_mask().
grep-ing drivers/net/* shows that in many drivers
the return value of pci_set_consistent_dma_mask() is checked
in the path where pci_set_dma_mask() was already successfull.
Sure, this is during driver's initiallysation, so it is not time critical.
My question: Is it worth to remove the unnecessary checks?
I could prepare patches if you find it worthfull.
Best regards.
Marin Mitov
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: pci_set_consistent_dma_mask() question
2008-05-25 5:43 pci_set_consistent_dma_mask() question Marin Mitov
@ 2008-05-25 18:59 ` Arjan van de Ven
0 siblings, 0 replies; 2+ messages in thread
From: Arjan van de Ven @ 2008-05-25 18:59 UTC (permalink / raw)
To: Marin Mitov; +Cc: linux-kernel, netdev
On Sun, 25 May 2008 08:43:47 +0300
Marin Mitov <mitov@issp.bas.bg> wrote:
> Hi all,
>
> In the file: Documentation/DMA-mapping.txt is written:
>
> pci_set_consistent_dma_mask() will always be able to set the same or a
> smaller mask as pci_set_dma_mask(). However for the rare case that a
> device driver only uses consistent allocations, one would have to
> check the return value from pci_set_consistent_dma_mask().
>
> grep-ing drivers/net/* shows that in many drivers
> the return value of pci_set_consistent_dma_mask() is checked
> in the path where pci_set_dma_mask() was already successfull.
> Sure, this is during driver's initiallysation, so it is not time
> critical.
>
> My question: Is it worth to remove the unnecessary checks?
> I could prepare patches if you find it worthfull.
>
I think it would actually be harmful. Checking for errors even if they
shouldn't happen for things like this makes drivers better! If something
weird is going on it gets detected earlier... IN general, defensive
programming makes a lot of sense.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-25 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-25 5:43 pci_set_consistent_dma_mask() question Marin Mitov
2008-05-25 18:59 ` Arjan van de Ven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).