Closed markshank closed 2 years ago
Be careful - we can't just drop GPL code into the kernel without potentially tainting the whole thing. This code looks pretty trivial and I think even if we were to write an original implementation it would look virtually identical - so maybe is OK. Copyright (and therefore licensing) doesn't apply to something that has just one obvious solution, and this appears to be such a case. This StackOverflow post expresses it pretty well:
In copyright law, expression is copyrightable, and ideas are not copyrightable. In particular, expression is copyrightable only insofar as that expression is distinct from the idea is expresses. This is closely related to the "merger doctrine," which states that when an idea can only be expressed in a limited number of ways, then expressions of that idea are not copyrightable: that is, the idea and the expression are inextricably "merged" with one another.
I spent a little time looking around for a better place for this code. The best I could come up with on short notice is in drm-kmod with the i915 source. Would that make it upstream worthy?
And I should uncomment the two lines of code and wrap them with "#ifdef __linux__" and "#endif" instead.
This goes a different direction that we originally started with. So I undid some of ayeed and mszoek prep work.
I simply lifted the pci_iomap_range code from Linux and dropped it into the Kernel tree. I had expected to have to butcher it up to get it to work. Imagine my surprise when I only had to comment out two lines that weren't needed for my use case. It just compiled and worked!
I suspect that because of how close to Linux original it is, I have it in the wrong place in the tree. That should probably be revisited if we want to submit it upstream.
I tested it on bare metal with ravynOS to satisfy myself that I didn't break it there. I have had various degrees of success in FreeBSD virtual machines. I haven't found a way to test it with ravynOS in a VM yet. That's why I have created this pull request. So I can have it in a ravynOS iso.