From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759322AbdEWHBS (ORCPT ); Tue, 23 May 2017 03:01:18 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51734 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965955AbdEWHBQ (ORCPT ); Tue, 23 May 2017 03:01:16 -0400 Date: Tue, 23 May 2017 09:01:14 +0200 (CEST) From: Thomas Gleixner To: Christoph Hellwig cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel: mark all struct k_clock instances const In-Reply-To: <20170523044851.GA15761@lst.de> Message-ID: References: <20170515203213.25080-1-hch@lst.de> <20170523044851.GA15761@lst.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 May 2017, Christoph Hellwig wrote: > On Tue, May 23, 2017 at 12:17:31AM +0200, Thomas Gleixner wrote: > > On Mon, 15 May 2017, Christoph Hellwig wrote: > > > > > And keep a pointer to it instead of a copy in the posix_clocks array. > > > > > > Based on similar changes in the Grsecurity patchset, but redone from > > > scratch including a few tweaks. > > > > Hmm, that adds another level of indirection, but yes, we can do it. > > > > > diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c > > > index 0e7fcb04f01e..e501403dd860 100644 > > > --- a/drivers/char/mmtimer.c > > > +++ b/drivers/char/mmtimer.c > > > @@ -53,7 +53,7 @@ MODULE_LICENSE("GPL"); > > > > > > #define RTC_BITS 55 /* 55 bits for this implementation */ > > > > > > -static struct k_clock sgi_clock; > > > +static const struct k_clock sgi_clock; > > > > Bah. This mmtimer which is used by 3 people in the world requires that we > > keep the register_clock() function around after init and even export it. > > We can require the driver to be built into the kernel, which seems pretty > reasonable for a timer. It's only selectable on IA64 anyway. That still requires that we "register" the clock as it's SN2 specific and we don't want to end up with a non initialized clock .... Thanks, tglx