[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Appliquer un patch mode d'emploi ?



e mardi 12 mai 2009, Pascal Hambourg a écrit :
> Salut,
>
> Philippe Merlin a écrit :
> > J'essaie d'appliquer ce patch au noyau standard debian, je sèche
> > lamentablement, j'ai essayé patch -p1< fichier
> > sans succès .
>
> Mais encore (message d'erreur détaillé) ?
>
> > https://www.linuxhq.com/kernel/v2.6/26-git17/sound/core/init.c
>
> Si tu as copié/collé le patch depuis cette page, le problème pourrait
> être que la conversion en HTML a transformé les tabulations en espaces,
> et donc patch ne s'y retrouve pas. Il faudrait trouver le patch sous
> forme de fichier brut.
(Tète de linotte j'ai oublié de joindre le fichier je renvoie le message)
merci pour ta réponse, effectivement j'ai fait un copier coller, si c'est le 
problème alors ou trouver ce patch
Les erreurs 5 Hunks rejected.
Je joins le fichier du patch que je veux appliquer, si vous pouviez donner 
votre avis.
J'ai essayé avec Kompare  il semble bien faire les modifs mais je n'arrive pas 
à sauvegarder ces modifs.
Merci.
Philipppe
diff --git a/sound/core/init.c b/sound/core/init.c
index ac05734..df46bbc 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -46,17 +46,24 @@ static char *slots[SNDRV_CARDS];
 module_param_array(slots, charp, NULL, 0444);
 MODULE_PARM_DESC(slots, "Module names assigned to the slots.");
 
-/* return non-zero if the given index is already reserved for another
+/* return non-zero if the given index is reserved for the given
  * module via slots option
  */
-static int module_slot_mismatch(struct module *module, int idx)
+static int module_slot_match(struct module *module, int idx)
 {
+   int match = 1;
 #ifdef MODULE
-   char *s1, *s2;
+   const char *s1, *s2;
+
    if (!module || !module->name || !slots[idx])
       return 0;
-   s1 = slots[idx];
-   s2 = module->name;
+
+   s1 = module->name;
+   s2 = slots[idx];
+   if (*s2 == '!') {
+      match = 0; /* negative match */
+      s2++;
+   }
    /* compare module name strings
     * hyphens are handled as equivalent with underscore
     */
@@ -68,12 +75,12 @@ static int module_slot_mismatch(struct module *module, int idx)
       if (c2 == '-')
          c2 = '_';
       if (c1 != c2)
-         return 1;
+         return !match;
       if (!c1)
          break;
    }
-#endif
-   return 0;
+#endif /* MODULE */
+   return match;
 }
 
 #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
@@ -129,7 +136,7 @@ struct snd_card *snd_card_new(int idx, const char *xid,
           struct module *module, int extra_size)
 {
    struct snd_card *card;
-   int err;
+   int err, idx2;
 
    if (extra_size < 0)
       extra_size = 0;
@@ -144,35 +151,41 @@ struct snd_card *snd_card_new(int idx, const char *xid,
    err = 0;
    mutex_lock(&snd_card_mutex);
    if (idx < 0) {
-      int idx2;
       for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++)
          /* idx == -1 == 0xffff means: take any free slot */
          if (~snd_cards_lock & idx & 1<<idx2) {
-            if (module_slot_mismatch(module, idx2))
-               continue;
-            idx = idx2;
-            if (idx >= snd_ecards_limit)
-               snd_ecards_limit = idx + 1;
-            break;
+            if (module_slot_match(module, idx2)) {
+               idx = idx2;
+               break;
+            }
+         }
+   }
+   if (idx < 0) {
+      for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++)
+         /* idx == -1 == 0xffff means: take any free slot */
+         if (~snd_cards_lock & idx & 1<<idx2) {
+            if (!slots[idx2] || !*slots[idx2]) {
+               idx = idx2;
+               break;
+            }
          }
-   } else {
-       if (idx < snd_ecards_limit) {
-         if (snd_cards_lock & (1 << idx))
-            err = -EBUSY;   /* invalid */
-      } else {
-         if (idx < SNDRV_CARDS)
-            snd_ecards_limit = idx + 1; /* increase the limit */
-         else
-            err = -ENODEV;
-      }
    }
-   if (idx < 0 || err < 0) {
+   if (idx < 0)
+      err = -ENODEV;
+   else if (idx < snd_ecards_limit) {
+      if (snd_cards_lock & (1 << idx))
+         err = -EBUSY;   /* invalid */
+   } else if (idx >= SNDRV_CARDS)
+      err = -ENODEV;
+   if (err < 0) {
       mutex_unlock(&snd_card_mutex);
       snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i), error: %d\n",
           idx, snd_ecards_limit - 1, err);
       goto __error;
    }
    snd_cards_lock |= 1 << idx;      /* lock it */
+   if (idx >= snd_ecards_limit)
+      snd_ecards_limit = idx + 1; /* increase the limit */
    mutex_unlock(&snd_card_mutex);
    card->number = idx;
    card->module = module;
@@ -535,8 +548,9 @@ int snd_card_register(struct snd_card *card)
    snd_assert(card != NULL, return -EINVAL);
 #ifndef CONFIG_SYSFS_DEPRECATED
    if (!card->card_dev) {
-      card->card_dev = device_create(sound_class, card->dev, 0,
-                      "card%i", card->number);
+      card->card_dev = device_create_drvdata(sound_class, card->dev,
+                         MKDEV(0, 0), NULL,
+                         "card%i", card->number);
       if (IS_ERR(card->card_dev))
          card->card_dev = NULL;
    }




Reply to: