[lkml]   [2012]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] regulator: Fix and simplify debugfs support
On Sat, Feb 18, 2012 at 11:28:25PM -0800, Stephen Boyd wrote:
> If CONFIG_DEBUG_FS=y debugfs functions will never return an
> ERR_PTR. Instead they'll return NULL. The intent is to remove
> ifdefs in calling code.

> Instead of checking for an ERR_PTR check for NULL. This simplifies
> the code and also fixes an error check that would never have
> worked otherwise. While we're here modernize the code to use
> S_IRUGO instead of 0444.

This was actually a deliberate decision to make the code more robust
against change - the IS_ERR_OR_NULL doesn't make the code any bigger but
it means it's less likely to break in the face of changes.

> If we're willing to sacrifice a pointer per rdev we can remove the
> ifdefs and the compiler should be able to optimize away the dead
> code.

Personally I'd be happy to do that, the only reason I put the ifdefs in
there was that it appears to be idiomatic to do so but I'm not really a
big fan of it. Then again I never build kernls without debugfs support
in them myself...
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2012-02-20 03:15    [W:0.041 / U:1.888 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site