* [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter
@ 2017-10-02 19:32 Jérôme Glisse
2017-10-02 21:40 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Jérôme Glisse @ 2017-10-02 19:32 UTC (permalink / raw)
To: linux-kernel, linux-mm
Cc: Ralph Campbell, Jérôme Glisse, Andrew Morton
From: Ralph Campbell <rcampbell@nvidia.com>
Constify pointer parameter to avoid issue when use from code that
only has const struct page pointer to use in the first place.
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/hmm.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/hmm.h b/include/linux/hmm.h
index 96e6997..325017a 100644
--- a/include/linux/hmm.h
+++ b/include/linux/hmm.h
@@ -471,9 +471,9 @@ static inline void hmm_devmem_page_set_drvdata(struct page *page,
* @page: pointer to struct page
* Return: driver data value
*/
-static inline unsigned long hmm_devmem_page_get_drvdata(struct page *page)
+static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page)
{
- unsigned long *drvdata = (unsigned long *)&page->pgmap;
+ const unsigned long *drvdata = (const unsigned long *)&page->pgmap;
return drvdata[1];
}
--
2.4.11
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter
2017-10-02 19:32 [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter Jérôme Glisse
@ 2017-10-02 21:40 ` Andrew Morton
2017-10-02 21:47 ` Jerome Glisse
2017-10-02 21:54 ` Ralph Campbell
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2017-10-02 21:40 UTC (permalink / raw)
To: Jérôme Glisse; +Cc: linux-kernel, linux-mm, Ralph Campbell
On Mon, 2 Oct 2017 15:32:54 -0400 Jérôme Glisse <jglisse@redhat.com> wrote:
> From: Ralph Campbell <rcampbell@nvidia.com>
>
> Constify pointer parameter to avoid issue when use from code that
> only has const struct page pointer to use in the first place.
That's rather vague. Does such calling code exist in the kernel? This
affects the which-kernel-gets-patched decision.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter
2017-10-02 21:40 ` Andrew Morton
@ 2017-10-02 21:47 ` Jerome Glisse
2017-10-02 21:54 ` Ralph Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Jerome Glisse @ 2017-10-02 21:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-mm, Ralph Campbell
On Mon, Oct 02, 2017 at 02:40:42PM -0700, Andrew Morton wrote:
> On Mon, 2 Oct 2017 15:32:54 -0400 Jerome Glisse <jglisse@redhat.com> wrote:
>
> > From: Ralph Campbell <rcampbell@nvidia.com>
> >
> > Constify pointer parameter to avoid issue when use from code that
> > only has const struct page pointer to use in the first place.
>
> That's rather vague. Does such calling code exist in the kernel? This
> affects the which-kernel-gets-patched decision.
This is use by device driver, no driver upstream yet so it does not
affect anybody upstream yet.
Jerome
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter
2017-10-02 21:40 ` Andrew Morton
2017-10-02 21:47 ` Jerome Glisse
@ 2017-10-02 21:54 ` Ralph Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Ralph Campbell @ 2017-10-02 21:54 UTC (permalink / raw)
To: Andrew Morton, Jérôme Glisse; +Cc: linux-kernel, linux-mm
The use case is when called by struct hmm_devmem_ops.fault() which passes a const struct page * pointer and hmm_devmem_page_get_drvdata() is called to get the private data.
Since HMM was only recently added, it only affects kernels after September 8, 2017.
> -----Original Message-----
> From: Andrew Morton [mailto:akpm@linux-foundation.org]
> Sent: Monday, October 2, 2017 2:41 PM
> To: Jérôme Glisse <jglisse@redhat.com>
> Cc: linux-kernel@vger.kernel.org; linux-mm@kvack.org; Ralph Campbell
> <rcampbell@nvidia.com>
> Subject: Re: [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata()
> parameter
>
> On Mon, 2 Oct 2017 15:32:54 -0400 Jérôme Glisse <jglisse@redhat.com>
> wrote:
>
> > From: Ralph Campbell <rcampbell@nvidia.com>
> >
> > Constify pointer parameter to avoid issue when use from code that only
> > has const struct page pointer to use in the first place.
>
> That's rather vague. Does such calling code exist in the kernel? This affects the
> which-kernel-gets-patched decision.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-02 21:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-02 19:32 [PATCH] mm/hmm: constify hmm_devmem_page_get_drvdata() parameter Jérôme Glisse
2017-10-02 21:40 ` Andrew Morton
2017-10-02 21:47 ` Jerome Glisse
2017-10-02 21:54 ` Ralph Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox