Date:2012-03-06 14:17:59 (8 years 6 months ago)
Author:Paul Cercueil
Commit:1a7fb60f9e73f5947bee848b1c2e170c0d25c4cb
Message:MIPS: JZ4740: use standard module_param() macro for the 'panel' parameter.

Files: drivers/video/jz4740_slcd_panels.c (2 diffs)

Change Details

drivers/video/jz4740_slcd_panels.c
2323
2424#include "jz4740_slcd.h"
2525
26static unsigned int jz_slcd_panel = 0;
26static char *default_slcd_panel;
2727
2828/* Send a command without data. */
2929static void send_panel_command(struct jzfb *jzfb, u32 cmd) {
...... 
477477#endif
478478};
479479
480static int __init jz_slcd_panels_setup(char *this_opt)
481{
482    char *options;
483
484    while ((options = strsep(&this_opt, ",")) != NULL) {
485        if (!strncmp(options, "panel:", 6)) {
486            unsigned int i;
487
488            options += 6;
489            for (i = 0; i < ARRAY_SIZE(jz_slcd_panels); i++) {
490                if (!strcmp(options, jz_slcd_panels[i].name)) {
491                    jz_slcd_panel = i;
492                    break;
493                }
494            }
480module_param_named(panel, default_slcd_panel, charp, 0);
481MODULE_PARM_DESC(panel, "SLCD panel used on the device");
495482
496            continue;
497        }
483static const struct jz_slcd_panel *jz_slcd_panel_from_name(const char *name)
484{
485    unsigned int i;
486    for (i = 0; i < ARRAY_SIZE(jz_slcd_panels); i++) {
487        if (sysfs_streq(name, jz_slcd_panels[i].name))
488            return &jz_slcd_panels[i];
498489    }
499
500    return 0;
490    return NULL;
501491}
502492
503__setup("jz_slcd=", jz_slcd_panels_setup);
504
505493const struct jz_slcd_panel *jz_slcd_panels_probe(struct jzfb *jzfb)
506494{
507    switch (ARRAY_SIZE(jz_slcd_panels)) {
508    case 0:
495    const struct jz_slcd_panel *panel;
496    if (ARRAY_SIZE(jz_slcd_panels) == 0)
509497        return NULL;
510    case 1:
511        return &jz_slcd_panels[0];
512    default:
513        return &jz_slcd_panels[jz_slcd_panel];
498
499    panel = &jz_slcd_panels[0];
500
501    if (default_slcd_panel) {
502        panel = jz_slcd_panel_from_name(default_slcd_panel);
503        if (!panel) {
504            struct device *dev = &jzfb->pdev->dev;
505            dev_err(dev, "Unknown SLCD panel: %s\n",
506                        default_slcd_panel);
507        }
514508    }
509    return panel;
515510}

Archive Download the corresponding diff file



interactive