lkml.org 
[lkml]   [2004]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [rfc][patch] DRM initial function table support.
    On Tue, Aug 31, 2004 at 09:07:11AM -0700, Ian Romanick wrote:
    > I think the intention is to have default functions set in the
    > device-independent code and have the device-dependent code over-ride
    > them. Since the defaults may not always be NULL, doing a struct like
    > that wouldn't really work. I suppose we could have a struct and a
    > device-independent function that copies the non-NULL pointers from the
    > per-device struct. Would that be better?

    Don't copy them. Just put

    if (foo->ops->method1)
    foo->ops->method1(args);
    else
    generic_method1(args);

    in your code. It's an additional branch, but you avoid the indirect
    functioncalloverhead in exchange.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:05    [W:0.051 / U:0.024 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site