linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH V2] powerpc/kernel/sysfs: disable writing to purr in non-powernv
Date: Tue, 01 Oct 2013 17:50:30 +1000	[thread overview]
Message-ID: <1380613830.645.18.camel@pasglop> (raw)
In-Reply-To: <20131001063129.GF17966@concordia>

On Tue, 2013-10-01 at 16:31 +1000, Michael Ellerman wrote:

> > 1)Changed the test for to hypervisor mode instead of platform
> 
> I think Ben's wrong about that.
> 
> Almost all existing code uses FW_FEATURE_LPAR to differentiate
> hypervisor vs guest mode, so I think we should do the same here.

I didn't object to using the FW test, it's a reasonable way to do it, I
objected to using the platform as an indication (powernv vs. pseries)

Ben.

> So it would be:
> 
> > +	if (cpu_has_feature(CPU_FTR_PURR)) {
> > +		if (!firmware_has_feature(FW_FEATURE_LPAR))
> > +			add_write_permission_dev_attr((void *)&dev_attr_purr);
> >  		device_create_file(s, &dev_attr_purr);
> > +	}
> 
> 
> > +static void add_write_permission_dev_attr(void *ptr)
> > +{
> > +	struct device_attribute *attr = (struct device_attribute *)ptr;
> > +
> > +	attr->attr.mode |= (unsigned short) 0200;
> > +}
> 
> Why does it take a void *, which then requires a cast at the call site?
> 
> And do you need the cast to short? If so shouldn't you use umode_t
> directly?
> 
> cheers

  reply	other threads:[~2013-10-01  7:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 11:33 [PATCH V2] powerpc/kernel/sysfs: disable writing to purr in non-powernv Madhavan Srinivasan
2013-10-01  6:31 ` Michael Ellerman
2013-10-01  7:50   ` Benjamin Herrenschmidt [this message]
2013-10-01  8:43     ` Michael Ellerman
2013-10-01  8:09   ` Madhavan Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380613830.645.18.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=michael@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).