lkml.org 
[lkml]   [2004]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Proposal for new generic device API: dma_get_required_mask()
    From
    Date
    On Thu, 2004-06-17 at 19:46, Krzysztof Halasa wrote:
    > #define OUR_COST_32 = 4
    > #define OUR_COST_39 = 8
    > #define OUR_COST_64 = 10
    >
    > int cost32 = check_dma_mask(32 bits);
    > int cost39 = check_dma_mask(39 bits);
    > int cost64 = check_dma_mask(64 bits);
    >
    > if (!cost32 && !cost39 && !cost64)
    > printk(KERN_ERR "64 bits aren't enough for RAM addressing?\n")
    > else
    > use_mode_with_minimal_cost(cost32 * OUR_COST_32,
    > cost39 * OUR_COST_39,
    > cost64 * OUR_COST_64);
    >
    > This check_dma_mask() should be renamed + extended to cover different
    > RAM access types:
    > - coherent vs non-coherent memory
    > - preallocated/initialized memory (such as skb->data passed to
    > hard_start_xmit()) vs uninitialized memory (such as returned by
    > kmalloc()).

    Well, I did consider a similar API, but not for long.

    It falls victim to the 95/5 rule---when you engineer an API, if 95% of
    the complexity is dealing with the 5% of special cases, you're over
    engineering.

    So the original proposal is the remaining 5% that covers 95% of the use
    cases (and will do better even on the remaining 5%).

    James


    -
    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:03    [W:0.021 / U:126.984 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site